Folks, more hours wasted attempting to add a custom header to a HttpClient
request. I just coded this:

client.DefaultRequestHeaders.Add("X-SessionId", "F15C32D9D8E52D45");

But I was getting 400 request badly formed, which Fiddler showed was caused
by this in the header:

X-SessionId: F15C32D9D8E52D45Host: localhost:52484
You can see the two headers have joined. I searched until my fingers bled
but found no hints. By complete bumbling around I eventually found that by
appending \n + space to the end of the header value fixed things. This puts
a space at the end of the header value, but luckily it's ignored when I
read the header back later.

Has anyone experienced weirdness like this with headers?

*Greg K*

Reply via email to