[swift-server-dev] HTTP API Review
BAILEYC at uk.ibm.com
Sun Sep 10 10:09:29 CDT 2017
Thanks for the feedback Georgios.
I'll raise a PR for the change of writeHeader()/writeBody() to write() and
see if there's any objections.
From: Georgios Moschovitis <george.moschovitis at icloud.com>
To: Chris Bailey <BAILEYC at uk.ibm.com>
Cc: swift-server-dev at swift.org
Date: 09/09/2017 09:17
Subject: Re: [swift-server-dev] HTTP API Review
>> - `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 :-)
Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-server-dev