Skip to content
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

Guard valid content type check against bad Content-Type #132

Merged
merged 1 commit into from Oct 5, 2021

Conversation

remear
Copy link
Member

@remear remear commented Oct 5, 2021

Purpose

Avoid undefined method 'start_with?' for nil:NilClass in Rack::MediaType strip_doublequotes when given a bad content type.

Additional helpful information

Given:

Clients MUST send all JSON:API data in request documents with the header
Content-Type: application/vnd.api+json without any media type
parameters.

Clients MUST ignore any parameters for the application/vnd.api+json
media type received in the Content-Type header of response documents.

We can just check if the content type == application/vnd.api+json.

Avoid `undefined method 'start_with?' for nil:NilClass` in
`Rack::MediaType` `strip_doublequotes` when given a bad content type.

Given:

Clients MUST send all JSON:API data in request documents with the header
Content-Type: application/vnd.api+json without any media type
parameters.

Clients MUST ignore any parameters for the application/vnd.api+json
media type received in the Content-Type header of response documents.

We can just check if the content type == `application/vnd.api+json`.
@remear remear merged commit b8b3c4b into master Oct 5, 2021
@remear remear deleted the guard-bad-content-type branch October 5, 2021 16:49
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.

None yet

1 participant