klein
klein copied to clipboard
Make new request/response API public
Make new request/response API public. That would add to the package (__init__.py):
- From
_imessage.py:FountAlreadyAccessedErrorIHTTPHeadersIMutableHTTPHeadersIHTTPMessageIHTTPRequestIHTTPResponse
- From
_headers.py:FrozenHTTPHeadersMutableHTTPHeaders
- From
_request.py:FrozenHTTPRequest
- From
_request_compat.py:HTTPRequestWrappingIRequest
- From
_response.py:FrozenHTTPResponse
Before these become public, the following tickets need to be addressed:
- [x] #227: Decide whether to keep polymorphic text/bytes in headers API
- [x] #239: Use DecodedURL
This is mostly here to keep track of what needs to happen first.
We might want to chat a little bit about accessing the request objects via this new API vs. accessing them entirely through dependency injection. For example:
@route.get("/blah")
def blah(self, request):
request.someNicerMethodForRetrievingAHeader(...)
vs.
@require(route.get("/blah"), header=Header("hello-world"))
def blah(self, header):
print(header)
we are using an entirely request-less style at work and I'm really digging it.