[swift-server-dev] HTTP API Review
george.moschovitis at icloud.com
Sat Sep 9 03:17:45 CDT 2017
> >> - `HTTPBodyProcessing` is a very long word with no obvious meaning.
> Agreed, the naming here could be clearer as to what its purpose is. Do you have any suggestions?
Unfortunately, no :(
> >> - I would use `HTTPResponse` instead of `HTTPResponseWriter`
> The use of HTTPResponseWriter here is very deliberate because eventually the API should be symmetrical for the server and client use cases, ie: a server has access to a HTTPRequest and a HTTPResponseWriter, and a client has access to a HTTPRequestWriter and a HTTPResponse.
Hm, that makes sense.
> >> - I would rename `writeBody` to `write` (and, maybe, `writeHeader` to `addHeader`, `setHeader`, `appendHeader` or something similar)
> I think if we we're to switch to using "write()" for writeBody(), then we'd have to move to:
> func write(headers: HTTPHeaders, status: HTTPResponseStatus, completion: @escaping (Result) -> Void)
> func write(body: UnsafeHTTPResponseBody, completion: @escaping (Result) -> Void)
> How does that look?
Ah, that looks even more Swifty, I like it :-)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-server-dev