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

fix(stream-responses): Stream response is stringified if Content-Type is application/json #137

Merged
merged 2 commits into from Jun 6, 2019

Conversation

Projects
None yet
2 participants
@krzysztof-miemiec
Copy link
Contributor

commented Jun 5, 2019

PR Type

What kind of change does this PR introduce?

[x] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Other... Please describe:

What is the current behavior?

A stream body is being stringified when:

  • Content-Type header is set explicitly to application/json
  • Content-Type header is not specified (it defaults to case above)
    It also causes a header conflict when Transfer-Encoding header is explicitly set to chunked, because body is not a stream which causes Content-Length header to be set.

What is the new behavior?

Body is not stringified when it's a stream, regardless of Content-Type header.

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

It fixes issue with #136 testing, where I try to send JSON as streamed body.

@krzysztof-miemiec krzysztof-miemiec requested a review from JozefFlakus Jun 5, 2019

@krzysztof-miemiec krzysztof-miemiec self-assigned this Jun 5, 2019

@codecov

This comment has been minimized.

Copy link

commented Jun 5, 2019

Codecov Report

Merging #137 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #137   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          98     98           
  Lines        1149   1151    +2     
  Branches      107    108    +1     
=====================================
+ Hits         1149   1151    +2
Impacted Files Coverage Δ
packages/core/src/response/responseBody.factory.ts 100% <100%> (ø) ⬆️

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 fc75854...26d9283. Read the comment docs.

@JozefFlakus JozefFlakus merged commit d8f7b64 into master Jun 6, 2019

2 checks passed

Travis CI - Pull Request Build Passed
Details
codecov/patch 100% of diff hit (target 100%)
Details

@JozefFlakus JozefFlakus deleted the fix/stream-responses branch Jun 6, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.