klein icon indicating copy to clipboard operation
klein copied to clipboard

Make new request/response API public

Open wsanchez opened this issue 7 years ago • 2 comments

Make new request/response API public. That would add to the package (__init__.py):

  • From _imessage.py:
    • FountAlreadyAccessedError
    • IHTTPHeaders
    • IMutableHTTPHeaders
    • IHTTPMessage
    • IHTTPRequest
    • IHTTPResponse
  • From _headers.py:
    • FrozenHTTPHeaders
    • MutableHTTPHeaders
  • 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

wsanchez avatar Oct 10 '18 01:10 wsanchez

This is mostly here to keep track of what needs to happen first.

wsanchez avatar Oct 10 '18 01:10 wsanchez

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.

glyph avatar Oct 18 '18 04:10 glyph