Skip to content

Use newer Unprocessable Content naming for 422#1638

Merged
iMacTia merged 4 commits intolostisland:mainfrom
tylerhunt:unprocessable-content-error
Sep 21, 2025
Merged

Use newer Unprocessable Content naming for 422#1638
iMacTia merged 4 commits intolostisland:mainfrom
tylerhunt:unprocessable-content-error

Conversation

@tylerhunt
Copy link
Copy Markdown
Contributor

Description

Rename Faraday::UnprocessableEntityError to Faraday::UnprocessableContentError but provide compatibility with the older error constant through the use of an included module.

This is based on the status code name specified by IETF RFC 9110. Rack 3.1 was updated to account for this change (rack/rack#2137), and Rails has added support for it (rails/rails#53383), as well.

Copy link
Copy Markdown
Member

@iMacTia iMacTia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @tylerhunt and apologies for taking so long to get back to you 🙇

I appreciate the change, but I'd suggest using a straight constant assignment to provide backwards compatibility as opposed to turning UnprocessableEntity into a module and including it in the new class.

Appreciate this PR has been open for a while, so I'll proceed with this change myself.

Comment thread lib/faraday/error.rb Outdated
end

# Used to provide compatibility with legacy error name.
module UnprocessableEntityError
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather use a constant assignment to keep this as a class

@iMacTia iMacTia merged commit 0e008c5 into lostisland:main Sep 21, 2025
8 checks passed
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