-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for "file" return args #284
Conversation
"returns" arguments mapped to an http header should not be included in the response body.
3953bfd
to
7f1cef1
Compare
I have simplified and reworked this feature. Instead of adding a new flag, I added a new type called "file": {
returns: { arg: 'body', type: 'file', root: true }
} This way the feature is focused on developer's intention (I want to return a raw file response) instead of implementation details (I want to skip json/xml encoding and send the value in raw form). This should make it easier for consumers of remoting metadata (e.g. loopback-swagger) to correctly handle this case. |
We should add a note to these docs: http://apidocs.strongloop.com/strong-remoting/#sharedmethod about the new Otherwise LGTM 👍 |
Added, see 0d4ea21 I'd like to document this feature in more details as part of #35, I'll probably create a new "doc" story for that. |
Allow users to specify { type: 'file', root: true } for the single argument that will be sent directly as the response body. The following values are supported for file the file argument: - String - Buffer - ReadableStream (anything that exposes .pipe() method)
0d4ea21
to
a85068e
Compare
Add support for "file" return args
…-2.x Add support for "file" return args [2.x] A back-port of #284
It's a great feature. What about |
@raymondfeng sounds good, please open a new issue to keep track of this feature request. |
Fix handling of return args with
http.target:header
. Arguments mapped to a response http header should not be included in the response body.Allow users to specify
{ type: 'file', root: true }
for the single argument that will be sent directly as the response body.The following values are supported for file the file argument:
Example usage:
Fix strongloop/loopback#2063
Connect to strongloop/loopback#213
Connect to #35
/to @ritch please review
/cc @raymondfeng @STRML