graphql-python / graphql-server

This is the core package for using GraphQL in a custom server easily
MIT License
120 stars 72 forks source link

Account for content type being included twice #114

Open ElementalWarrior opened 1 year ago

ElementalWarrior commented 1 year ago

Chrome appears to be providing content type twice sometimes, this results in load_json_body not being called.

Content-Type: application/json, application/json; charset=utf-8
kiendang commented 1 year ago

Could you elaborate on how did you encounter this issue? We encountered a similar issue with graphene-django earlier graphql-python/graphene-django#1404. Not sure if the two issues are related but would be nice to know the root cause of this if possible.

ElementalWarrior commented 1 year ago

Could you elaborate on how did you encounter this issue? We encountered a similar issue with graphene-django earlier graphql-python/graphene-django#1404. Not sure if the two issues are related but would be nice to know the root cause of this if possible.

Our FE code requested with headers Content-Type and separately content-type.

Chrome combines and sends as one.

kiendang commented 1 year ago

Our FE code requested with headers Content-Type and separately content-type.

Chrome combines and sends as one.

This was exactly the issue we had too. We fixed the code in graphene-django to include only content-type.

I think in this case the best solution if possible is changing the front end code to specify only content-type (preferably lowercase) but since you submitted this PR I guess that's difficult?

Right now I'm reluctant to accept this PR. The spec for media types in content-type clearly allows only 1 set of type/subtype so this change would go against the spec.