Skip to content

Conversation

keatonLiu
Copy link

If request with json parameter set, function execute_request will not use the inferred content_type even if data is None.
becuase of the following two lines:

# set content type if it isn't set
if content_type is not None and "content-type" not in self.headers:
    self.headers["Content-Type"] = content_type

If the inferred content-type of the previous request is 'x-www-url-form-encoded', then this request will also be set to 'x-www-url-form-encoded' because self.headers got modified, which is not expected.

We should check the content-type after the headers are processed(merged), then we can use the CaseInsensitiveDict feature to check if "content-type" is set, if not, use the inferred one.

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.

1 participant