Skip to content
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

Option to force pretty output on response, regardless of Content-type. #92

Closed
RogWilco opened this issue Sep 11, 2012 · 9 comments
Closed
Labels
enhancement New feature or enhancement

Comments

@RogWilco
Copy link

I'm noticing a few places where the response headers are coming back with a Content-type of "text/html" when they actually contain JSON. It would be nice if, in cases like these, you could somehow specify a format to "force" on the response so that the body could still be prettified.

@RogWilco
Copy link
Author

Ah, I see this is related to #67 which seems to address this very need. Closing ticket...

@RogWilco
Copy link
Author

Actually, looks like that change didn't make it in. Any chance something similar could be added in? Maybe a way to override the response headers with user-specified values (similar to the headers argument, but for responses)?

@RogWilco RogWilco reopened this Sep 11, 2012
@ghost
Copy link

ghost commented May 28, 2014

👍
This would be nice to have. Some servers respond with Content-Type: text/html and JSON bodies.

@marko-asplund
Copy link

+1

1 similar comment
@jlandahl
Copy link

+1

@dequis
Copy link

dequis commented Aug 3, 2014

FWIW, i'm workarounding invalid content type responses by piping the output to jq

@kfix
Copy link

kfix commented Jan 22, 2016

see #368

@jkbrzt jkbrzt closed this as completed in 74e4d0b Mar 1, 2016
@jkbrzt
Copy link
Member

jkbrzt commented Mar 1, 2016

Now with the --json, -j option HTTPie tries to detect JSON responses when the Content-Type is unknown or text/plain.

@dflock
Copy link

dflock commented Apr 13, 2016

Now with the --json, -j option HTTPie tries to detect JSON responses when the Content-Type is unknown or text/plain.

Right, but there's still no way to force it, so if the Content-Type is text/html but the content is JSON, then you're still out of luck - you have to pipe through jq or something.

Given the number of poorly configured REST API endpoints in the world, having the option to force/override the Content-Type seems like a valid request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or enhancement
Projects
None yet
Development

No branches or pull requests

7 participants