-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Conversation
Codecov Report
@@ 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
Continue to review full report at Codecov.
|
sanic/server.py
Outdated
else: | ||
self.write_error( | ||
HeaderExpectationFailed( | ||
"Unknow Expect: {expect}".format(expect=expect) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unknown?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch
tests/test_request_stream.py
Outdated
|
||
assert app.is_request_stream is True | ||
|
||
request, response = app.test_client.post("/method_view", data=data, headers={"EXPECT": "100-continue"}) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good
Can we get a more descriptive PR title? |
@seemethere added brief description. |
tests/test_request_stream.py
Outdated
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) |
There was a problem hiding this comment.
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? :)
Fix #1587
I've verified the fix with code-snippet posted in the issue page, and also added unit tests for verifying.