Skip to content

Conversation

mbeijen
Copy link
Contributor

@mbeijen mbeijen commented May 18, 2025

Summary

rfc9110 obsoletes the earlier rfc 7231. This document also includes some status codes that were previously only used for WebDAV and assigns more generic names to these status codes.

ref: https://www.rfc-editor.org/rfc/rfc9110.html#name-changes-from-rfc-7231

The status code constants are updated to reflect the new naming and the old constants are kept for backwards compatibility

  • HTTP_413_CONTENT_TOO_LARGE, previously HTTP_413_REQUEST_ENTITY_TOO_LARGE
  • HTTP_414_URI_TOO_LONG, previously HTTP_414_REQUEST_URI_TOO_LONG
  • HTTP_416_RANGE_NOT_SATISFIABLE, previously HTTP_416_REQUESTED_RANGE_NOT_SATISFIABLE
  • HTTP_422_UNPROCESSABLE_CONTENT, previously HTTP_422_UNPROCESSABLE_ENTITY

Checklist

  • I understand that this PR may be closed in case there was no previous discussion. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.

rfc9110 obsoletes the earlier rfc 7231. This document also includes some
status codes that were previously only used for WebDAV and assigns more
generic names to these status codes.

ref: https://www.rfc-editor.org/rfc/rfc9110.html#name-changes-from-rfc-7231

The status code constants are updated to reflect the new naming and the old
constants are kept for backwards compatibility

 - HTTP_413_CONTENT_TOO_LARGE, previously HTTP_413_REQUEST_ENTITY_TOO_LARGE
 - HTTP_414_URI_TOO_LONG, previously HTTP_414_REQUEST_URI_TOO_LONG
 - HTTP_416_RANGE_NOT_SATISFIABLE, previously
   HTTP_416_REQUESTED_RANGE_NOT_SATISFIABLE
 - HTTP_422_UNPROCESSABLE_CONTENT, previously
   HTTP_422_UNPROCESSABLE_ENTITY
Comment on lines 75 to 79
# for backwards compatibility
HTTP_413_REQUEST_ENTITY_TOO_LARGE = HTTP_413_CONTENT_TOO_LARGE
HTTP_414_REQUEST_URI_TOO_LONG = HTTP_414_URI_TOO_LONG
HTTP_416_REQUESTED_RANGE_NOT_SATISFIABLE = HTTP_416_RANGE_NOT_SATISFIABLE
HTTP_422_UNPROCESSABLE_ENTITY = HTTP_422_UNPROCESSABLE_CONTENT
Copy link
Owner

Choose a reason for hiding this comment

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

We need to use a __getattr__ on the module to check those. Please check the history on this file, you'll find how to implement it.

@Kludex
Copy link
Owner

Kludex commented Sep 7, 2025

We need to do this: b133ab4

@Kludex Kludex merged commit 40a8147 into Kludex:main Sep 13, 2025
7 checks passed
@mbeijen
Copy link
Contributor Author

mbeijen commented Sep 13, 2025

Thanks! And sorry i did not fix the PR up myself. Typical drive-by-committer 😉

fajpunk added a commit to lsst-sqre/safir that referenced this pull request Sep 17, 2025
Starlette deprecated the `HTTP_422_UNPROCESSABLE_ENTITY` constant and
changed it to `HTTP_422_UNPROCESSABLE_CONTENT` in [this
PR](Kludex/starlette#2939). We could either
change this constant in our code, or just use the status code int
directly.

This PR uses status code directly here rather than the new constant in
to avoid having to increase the lower bound on starlette. This is the
choice that the FastAPI folks made in [this
PR](https://github.com/fastapi/fastapi/pull/14077/files).
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