Dealing with http response headers


(Jerome) #1

Hi together,

I am playing around (a bit) with binding development.
I am trying to request a api which provides some custom http headers (mainly for erros) in their responses.
For now i am trying to use https://www.eclipse.org/smarthome/documentation/javadoc/org/eclipse/smarthome/io/net/http/HttpUtil.html for the api handling.

But as far as i could research, the available methods only respond with a string
(which seems to fit the needs for most usecases :smile:)

Can someone give me a hint/best practice how to get the response headers from a request?
The necessary and urgent data for dealing with the api is mainly provided in the String response too
(Read: I think it will work without those headers too),
but since they offer those additional headers it would be nice to be able to use them for some more detailed error handling.

Or to be a bit more detailed:
Can this be done with the esh api classes and methods and i just didn’t find it yet?
My main goal would be to use only esh api stuff if possible.

Thanks for reading and discussing here with me in forward.