Skip to content

Conversation

BoboTiG
Copy link
Contributor

@BoboTiG BoboTiG commented Sep 1, 2021

It implements the support for custom mime types.
It is a start, it will be used later in #1110 to support custom a charset.

Summary:

$ http --response-as 'appllication/xml' \
    https://raw.githubusercontent.com/httpie/httpie/master/tests/fixtures/xmldata/valid/simple_raw.xml

@BoboTiG BoboTiG requested a review from jkbrzt September 1, 2021 15:19
@codecov-commenter
Copy link

codecov-commenter commented Sep 2, 2021

Codecov Report

Merging #1134 (19cc12b) into master (4d7d6b6) will decrease coverage by 0.21%.
The diff coverage is 94.88%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1134      +/-   ##
==========================================
- Coverage   97.28%   97.07%   -0.22%     
==========================================
  Files          67       70       +3     
  Lines        4235     4405     +170     
==========================================
+ Hits         4120     4276     +156     
- Misses        115      129      +14     
Impacted Files Coverage Δ
tests/test_output.py 99.47% <ø> (ø)
tests/conftest.py 75.75% <50.00%> (-11.20%) ⬇️
tests/test_ssl.py 89.88% <63.63%> (-5.05%) ⬇️
httpie/output/formatters/colors.py 92.66% <83.33%> (-0.92%) ⬇️
httpie/output/utils.py 97.87% <97.87%> (ø)
httpie/__init__.py 100.00% <100.00%> (ø)
httpie/cli/argparser.py 95.60% <100.00%> (-0.76%) ⬇️
httpie/cli/constants.py 100.00% <100.00%> (ø)
httpie/cli/definition.py 100.00% <100.00%> (ø)
httpie/cli/requestitems.py 91.17% <100.00%> (ø)
... and 17 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bce2b3a...19cc12b. Read the comment docs.

@BoboTiG BoboTiG changed the title Allow to override the response Content-Type from options Allow to overwrite the response Content-Type from options Sep 2, 2021
@BoboTiG BoboTiG requested a review from jkbrzt September 23, 2021 07:56
Copy link
Member

@jkbrzt jkbrzt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about --response-as / --treat-response-as?

@BoboTiG
Copy link
Contributor Author

BoboTiG commented Sep 24, 2021

What would give both options when the charset is set?

--response-content-type='application/xml; charset=utf-8'
--response-as='application/xml; charset=utf-8'

🤔

I kind of like the --response-as. We could go with it if it is OK for you too when there is the charset specified also.

@jkbrzt
Copy link
Member

jkbrzt commented Sep 27, 2021

@BoboTiG I think --response-as=<content-type> works for the charset use case as well. Let’s go with it: if we end up not liking it, we can still easily change the name before the next release. Btw, you’ll be adding the charset docs for this option once the #1110 is finished, right?

@BoboTiG
Copy link
Contributor Author

BoboTiG commented Sep 27, 2021

Yes, charset code & doc have to be done with #1110.

@BoboTiG BoboTiG merged commit 9c89c70 into httpie:master Sep 27, 2021
@BoboTiG BoboTiG deleted the mickael/dev-253-allow-to-override-the-response-content branch September 27, 2021 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants