Simple-Web-Server icon indicating copy to clipboard operation
Simple-Web-Server copied to clipboard

Additional headers in config for HttpClient

Open moonshadow565 opened this issue 8 years ago • 2 comments

Would like something like WsClient's config.header for HttpClient that sets additional headers to be sent when connection is (re)opened :)

moonshadow565 avatar Dec 18 '17 18:12 moonshadow565

Thank you, but do you have an example use case for this so I can understand the importance of such a feature?

eidheim avatar Dec 19 '17 10:12 eidheim

I would use it with authorization header. Currently i generate bunch of methods (roughly 2000) that take custom POD struct. The struct has authorization header string saved as well as HttpClient class. In generated methods i have to pass that header to each and every request. I can't relay on the connection not being closed (keep-alive?) since there are both synch(prefered) and asynch methods being generated. So just to be safe from such cases i pass the auth header to each and every request :)

That being said if there was such option it would make Simple-Web-Server more similar to Simple-WebSocket-Server.

moonshadow565 avatar Dec 22 '17 13:12 moonshadow565