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

feat (status_codes): update HTTP status constants wrt RFC 9110 #2330

Merged
merged 14 commits into from
Sep 27, 2024

Conversation

prathik2401
Copy link
Contributor

@prathik2401 prathik2401 commented Sep 14, 2024

refactor(response): replace falcon.HTTPPayloadTooLarge with falcon.HTTPContentTooLarge

Closes #2276

Summary of Changes

Replace the usage of falcon.HTTPPayloadTooLarge with falcon.HTTPContentTooLarge in the codebase. This change aligns with the recent renaming of the class in the Falcon library. The new class name better reflects the purpose of the error, which is to indicate that the content of the request is too large for the server to process.

Related Issues

#2276

Pull Request Checklist

This is just a reminder about the most common mistakes. Please make sure that you tick all appropriate boxes. But please read our contribution guide at least once; it will save you a few review cycles!

If an item doesn't apply to your pull request, check it anyway to make it apparent that there's nothing to do.

  • Applied changes to both WSGI and ASGI code paths and interfaces (where applicable).
  • Added tests for changed code.
  • Prefixed code comments with GitHub nick and an appropriate prefix.
  • Coding style is consistent with the rest of the framework.
  • Updated documentation for changed code.
    • Added docstrings for any new classes, functions, or modules.
    • Updated docstrings for any modifications to existing code.
    • Updated both WSGI and ASGI docs (where applicable).
    • Added references to new classes, functions, or modules to the relevant RST file under docs/.
    • Updated all relevant supporting documentation files under docs/.
    • A copyright notice is included at the top of any new modules (using your own name or the name of your organization).
    • Changed/added classes/methods/functions have appropriate versionadded, versionchanged, or deprecated directives.
  • Changes (and possible deprecations) have towncrier news fragments under docs/_newsfragments/, with the file name format {issue_number}.{fragment_type}.rst. (Run towncrier --draft to ensure it renders correctly.)

If you have any questions to any of the points above, just submit and ask! This checklist is here to help you, not to deter you from contributing!

PR template inspired by the attrs project.

refactor(response): replace falcon.HTTPPayloadTooLarge with falcon.HTTPContentTooLarge

Replace the usage of falcon.HTTPPayloadTooLarge with falcon.HTTPContentTooLarge in the codebase. This change aligns with the recent renaming of the class in the Falcon library. The new class name better reflects the purpose of the error, which is to indicate that the content of the request is too large for the server to process.

Closes #2322
Copy link
Member

@CaselIT CaselIT left a comment

Choose a reason for hiding this comment

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

Thanks, left a comment and a question for other maintainers

falcon/__init__.py Outdated Show resolved Hide resolved
docs/changes/2.0.0.rst Outdated Show resolved Hide resolved
@CaselIT
Copy link
Member

CaselIT commented Sep 15, 2024

Can you add a newsfragment? It could read something similar to the 2.0 changelog line

@vytas7 vytas7 changed the title feat (status_codes) update HTTP status code constants wrt RFC 9110 feat (status_codes): update HTTP status constants wrt RFC 9110 Sep 22, 2024
Copy link

codecov bot commented Sep 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (f843b4f) to head (769f0f8).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #2330   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           63        63           
  Lines         7545      7553    +8     
  Branches      1238      1239    +1     
=========================================
+ Hits          7545      7553    +8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@vytas7 vytas7 left a comment

Choose a reason for hiding this comment

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

Thanks for this improvement!
We need to address a couple of issues before merging this (commented inline).

docs/changes/2.0.0.rst Outdated Show resolved Hide resolved
falcon/errors.py Show resolved Hide resolved
@vytas7 vytas7 self-requested a review September 26, 2024 21:30
Copy link
Member

@vytas7 vytas7 left a comment

Choose a reason for hiding this comment

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

I have taken the liberty of improving this myself, it should be more or less ready now.

Thanks once again for contributing @prathik2401.

Copy link
Member

@CaselIT CaselIT left a comment

Choose a reason for hiding this comment

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

not sere if we want to add module __getattr__ in the init to import HTTP_REQUEST_ENTITY_TOO_LARGE on demand and give a warning.

same in status? (maybe the warning could just be in status module __getattr__, the init one just imports it)

falcon/__init__.py Show resolved Hide resolved
@vytas7
Copy link
Member

vytas7 commented Sep 27, 2024

not sere if we want to add module __getattr__ in the init to import HTTP_REQUEST_ENTITY_TOO_LARGE on demand and give a warning.

same in status? (maybe the warning could just be in status module __getattr__, the init one just imports it)

No, I think we're good wrt HTTP_REQUEST_ENTITY_TOO_LARGE since Falcon 4.0 is a major release, and this constant belongs to an even older iteration, it should have been removed long ago. The previous one is HTTP_PAYLOAD_TOO_LARGE.

@vytas7 vytas7 merged commit 9b0f7da into falconry:master Sep 27, 2024
37 checks passed
@prathik2401 prathik2401 deleted the feat/update-status-codes branch October 1, 2024 10:52
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.

Update HTTP status code constants wrt RFC 9110
3 participants