-
Notifications
You must be signed in to change notification settings - Fork 4
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
Allow override of Content-Type
header for web-based calls
#186
Comments
Heh. So CGI says you can specify headers (namely Content-Type) by outputting them first before a newline and empty line. I'm guess that's how we'd want to do it. Unless we want to also auto-detect JSON output since that's so common..... |
Yeah the only problem is that the response writer automatically injects headers before sending request so it seems like a chicken/egg problem...
|
Yeah if it's optional it gets harder to properly determine if it's provided. And my idea of detecting JSON would mean buffering output. Not ruling anything out yet, but anybody have other ideas? |
One idea is to put it in command metadata. I think there is a proposal somewhere about expanding the cmd script format to do something like:
This would mean this command is always application/json though. But that's a step up from always text/plain for all commands. However, this would depend on the refactoring of our script building system. And formalizing a proposal for this meta-data idea. |
@progrium were you thinking of just using http.DetectContentType? https://golang.org/pkg/net/http/#DetectContentType Edit: After looking at the src it looks like json won't be detected |
General idea, but yes relevant types. |
Not sure of the best way to implement this, but currently all web-based requests come back with
Content-Type: text/plain
which in general is probably ok, but if the command is returning JSON or something, it'd be handy to be able to set the header accordingly.The text was updated successfully, but these errors were encountered: