-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
only set stream header on streamed output #1531
Conversation
License: MIT Signed-off-by: Jeromy <jeromyj@gmail.com>
@@ -182,6 +174,11 @@ func sendResponse(w http.ResponseWriter, req cmds.Request, res cmds.Response) { | |||
h.Set(contentLengthHeader, strconv.FormatUint(res.Length(), 10)) | |||
} | |||
|
|||
if _, ok := res.Output().(io.Reader); ok { | |||
mime = "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
preserve the comment, else we won't know why the hell we're setting mime = ""
in a few weeks. 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but i didnt like that comment... :(
There were the following issues with your Pull Request
Guidelines are available to help. Your feedback on GitCop is welcome on this issue This message was auto-generated by https://gitcop.com |
omg gitcop, shut up. If i want to use githubs online editor to write code, I can do so. I am an adult. |
@whyrusleeping then put the trailer in manually. don't blame gitcop, gitcop's right. |
// we set this header so clients have a way to know this is an output stream | ||
// (not marshalled command output) | ||
mime = "" | ||
h.Set(streamHeader, "1") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so only set the header when it is an io.Reader and mime is off?
is this right?. why doesnt a chan interface{}
have "StreamHeader: 1"
too? (it is written out like a stream). what does streamHeader mean exactly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
streamheader means that youre getting an arbitrary stream of data. chan interface{}
means youre getting a series of json objects.
only set stream header on streamed output
fixes #1528
License: MIT
Signed-off-by: Jeromy jeromyj@gmail.com