On Wed, Jun 17, 2020 at 2:26 PM John Cowan <xxxxxx@ccil.org> wrote:
That means unwrapping the list every time, or else saying the result is a string-or-list, which puts an extra burden on the caller to type-check and coalesce.

How about returning a pair?  The car is the coalesced string per the HTTP spec, the cdr is the indexes into that string where individual headers begin.  99% of the time, the cdr can be ignored, but requiring the normal user to call car on the result is not so burdensome.

How about instead providing a utility procedure that does the coalescing?  Most people would use that, but those who want total control could grab the raw values out of the Reply object.

And since the number of headers is almost never large, and in particular rarely gets larger than the point where using a data structure other than an alist makes things faster, and since alists allow preserving the order of all headers and especially of multiple values of the same header, I would use an alist for the headers.

Also, Reply should probably be called Response since that's the standard parlance.