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

account for wildcards when checking accepts header #13802

Merged
merged 4 commits into from
Oct 9, 2023

Conversation

i-just
Copy link
Contributor

@i-just i-just commented Oct 9, 2023

Description

When using craft\web\Request->accepts(), we should account for subtype wildcards in accepted content types.

With changes in this PR:

  • if getAcceptableContentTypes() contains "application/*" and you’re checking accepts('application/json'), the results should be true
  • if getAcceptableContentTypes() contains "application/json" and you’re checking accepts('application/*'), the results should be false
  • if getAcceptableContentTypes() contains "application/json" and you’re checking accepts('application/json'), the results should be true

Related issues

#13759

@i-just i-just requested a review from brandonkelly October 9, 2023 09:24
@i-just i-just marked this pull request as draft October 9, 2023 09:30
@i-just i-just marked this pull request as ready for review October 9, 2023 12:06
@brandonkelly brandonkelly merged commit 25093c1 into develop Oct 9, 2023
@brandonkelly brandonkelly deleted the bugfix/13759-request-accepts-mimetype-check branch October 9, 2023 18:41
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.

2 participants