This middleware will reorganize the incoming and/or outgoing headers in such a way that it combines any duplicates of headers that, on their own, can normally have more than one value, and any other headers will stay untouched.
This middleware WILL change the global order of headers (they will be put in alphabetical order), but keep the order of the same type of header. I.e. if there are 3 "Set-Cookie" headers, the first one will still be first, the second one will still be second, etc. But now they are guaranteed to be next to each other.
N.B. This Middleware assumes the headers it combines are correctly formatted. If one of the to-be-combined headers is malformed, the new combined header will also (probably) be malformed.