-
Notifications
You must be signed in to change notification settings - Fork 734
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
[Python] msrest does not enforce JSON Accept header #867
Comments
I would be keen to know how the other clients/languages support or enforce this. |
I believe we select the first accept type from the swagger that corresponds to application/json. |
Are you saying that if the Swagger file has: "produces": [
"application/json"
], We should add an Accept for application/json, if not leave the server decides? |
Side effect: do we have to refuse generate Python code if "produces" does not contains |
@lmazuel - I think it's okay to put this is msrest, |
Thank you @annatisch I will do a PR that way! |
@amarzavery |
Hi,
msrest does no content negotiation currently and then does not fill the Accept header in any request.
Unfortunately, not all provider use JSON by default when the Accept header is not present (this leads to problem like this Azure/azure-sdk-for-python#553, solved by adding the right Accept header)
In addition, msrest cannot currently handle XML data. All requests have to be JSON.
I suggest to force
Accept: application/json
in all requests done using msrest. This can be made at several places:What do you think?
I don't mind adding directly in msrest core code, since as I said msrest cannot parse XML anyway.
I can do the PR once you we agreed on the result.
@annatisch
The text was updated successfully, but these errors were encountered: