Fix issue with header prefixes, remove ambiguous header processing#105
Merged
zootalures merged 1 commit intomasterfrom May 4, 2020
Merged
Fix issue with header prefixes, remove ambiguous header processing#105zootalures merged 1 commit intomasterfrom
zootalures merged 1 commit intomasterfrom
Conversation
fb25fe5 to
c5e6c2f
Compare
garthy
suggested changes
Apr 30, 2020
| return await setup_fn_call_raw(handle_func, content, new_headers) | ||
|
|
||
|
|
||
| async def setup_fn_call_raw(handle_func, content=None, headers={}): |
There was a problem hiding this comment.
Suggested change
| async def setup_fn_call_raw(handle_func, content=None, headers={}): | |
| async def setup_fn_call_raw(handle_func, content=None, headers=None): | |
| if headers is None: | |
| headers = {} |
c5e6c2f to
ef8efd6
Compare
reclaro
reviewed
May 1, 2020
Contributor
reclaro
left a comment
There was a problem hiding this comment.
LGTM I am wonder if we can add a small test of the http override where we highlight the precedence of http headers over functions ones
98dd188 to
0ad1f5b
Compare
reclaro
reviewed
May 1, 2020
| if headers is not None: | ||
| for k, v in headers.items(): | ||
| k = k.lower() | ||
| print("looking at %s, %s-> %s" % (k, v, new_headers)) |
Contributor
There was a problem hiding this comment.
nit: i guess this is a leftover from the a debug session
reclaro
approved these changes
May 1, 2020
Contributor
reclaro
left a comment
There was a problem hiding this comment.
Thanks for adding tests and the logic to merge headers to we don't lose any value. The logic is a bit complicated and not perfect but this PR is fixing 2 bugs so i think we should merge it. There are a couple of unecessary print left in the code that should be removed.
0ad1f5b to
22e7d97
Compare
22e7d97 to
f5ef6a2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The python FDK has ambiguous and incorrect behaviour around header processing:
This fix resolves all three problems.
For the second problem, to avoid breaking an backwards compatibility I've added a
ctx.HTTPHeaders()method which only returns the incoming request headers.The testing behaviour was also ambiguous as it relies on the internal code in the FDK that is under test so I added a raw testing call that does not apply the internal transformations to headers to the test fixture.
Rather than using the function boundary to assert data I added a global capture to the fixture to retrieve the exact context presented to the function for testing.