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

Change method used to retrieve rack status #1457

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pareeohnos
Copy link

@pareeohnos pareeohnos commented Jun 21, 2024

This is a very small change to the way jsonapi-resources fetches the status code from the symbol. Currently, it makes use of Rack::Utils::SYMBOL_TO_STATUS_CODE, however this has started to break on new versions of Rack.

A change introduced to Rack deprecates the status :unprocessable_entity in favour of :unprocessable_content. By using the Rack::Utils::SYMBOL_TO_STATUS_CODE hash directly, no status is found due to the internal changes, which results in jsonapi-resources returning a 0 status when there are validation errors.

This is the first step to fixing the issue and is fully backwards compatible. In the future however, the status :unprocessable_entity should stopped being used entirely, however this will require checks to see which version of Rack is being used. I haven't tackled this here as I wasn't sure how best you wanted to handle this but I'd be happy to take a look at it in the future.

This fixes the issue #1456

All Submissions:

  • [x ] I've checked to ensure there aren't other open Pull Requests for the same update/change.
  • I've submitted a ticket for my issue if one did not already exist.
  • My submission passes all tests. (Please run the full test suite locally to cut down on noise from travis failures.)
  • I've used Github auto-closing keywords in the commit message or the description.
  • I've added/updated tests for this change.

New Feature Submissions:

  • I've submitted an issue that describes this feature, and received the go ahead from the maintainers.
  • My submission includes new tests.
  • My submission maintains compliance with JSON:API.

Bug fixes and Changes to Core Features:

  • I've included an explanation of what the changes do and why I'd like you to include them.
  • I've provided test(s) that fails without the change.

Test Plan:

Reviewer Checklist:

  • Maintains compliance with JSON:API
  • Adequate test coverage exists to prevent regressions

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