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 #1587: add support for handling Expect Header #1600

Merged
merged 4 commits into from
Jun 10, 2019
Merged

Conversation

yunstanford
Copy link
Member

@yunstanford yunstanford commented Jun 4, 2019

Fix #1587

I've verified the fix with code-snippet posted in the issue page, and also added unit tests for verifying.

@codecov
Copy link

codecov bot commented Jun 4, 2019

Codecov Report

Merging #1600 into master will increase coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1600      +/-   ##
==========================================
+ Coverage    91.3%   91.32%   +0.01%     
==========================================
  Files          18       18              
  Lines        1828     1832       +4     
  Branches      351      352       +1     
==========================================
+ Hits         1669     1673       +4     
  Misses        133      133              
  Partials       26       26
Impacted Files Coverage Δ
sanic/exceptions.py 100% <100%> (ø) ⬆️
sanic/request.py 97.37% <100%> (+0.01%) ⬆️

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 c151582...1b1a51c. Read the comment docs.

sanic/server.py Outdated
else:
self.write_error(
HeaderExpectationFailed(
"Unknow Expect: {expect}".format(expect=expect)
Copy link
Contributor

Choose a reason for hiding this comment

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

Unknown?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch


assert app.is_request_stream is True

request, response = app.test_client.post("/method_view", data=data, headers={"EXPECT": "100-continue"})
Copy link
Member

Choose a reason for hiding this comment

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

Maybe parameterize the test with different capitalization and variation of the header?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sounds good

@seemethere
Copy link
Member

Can we get a more descriptive PR title?

@yunstanford yunstanford changed the title Fix #1587 Fix #1587: add support for handling Expect Header Jun 4, 2019
@yunstanford
Copy link
Member Author

@seemethere added brief description.

else:
with pytest.raises(ValueError) as e:
app.test_client.post("/method_view", data=data, headers={"EXPECT": "100-continue-extra"})
assert "Unknow Expect: 100-continue-extra" in str(e)
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry for the flood but... Unknown? :)

@yunstanford yunstanford added this to the 19.6 milestone Jun 6, 2019
@seemethere seemethere merged commit 072fcfe into master Jun 10, 2019
@ahopkins ahopkins deleted the fix-100-continue branch June 11, 2019 03:41
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.

Request Streaming is extremely slow
4 participants