Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Customizable request class #875
Conversation
|
Dropping by out of curiosity — could you explicit some practical use cases that would motivate the ability to swap the request class? Maybe this is linked to an existing issue? |
I would store this to |
|
I am building an application that has a custom Request class. This class has extra methods related to it (input validation, helpers to get values from GET/POST, user IP, and many other helpers). In order to make use of it, I have to completely extend Route/HTTPEndpoint/request_response names. It is a huge overhead here. Also, it is useful for frameworks built on top of Starlette. They often have own request classes (look at HttpRequest in Django and Request in DRF). |

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

This allows users to change the default
Requestclass.There are following customization options:
request_classon Route constructor:This has higher precedence than
request_classdefined in HTTPEndpoint class.request_classin HTTPEndpoint: