I’m using the current Xojo 2017.2.1 for a web app:
I have a problem with the HTTP sockets:
The request with GET usually has a “response body” and “response header data”. I can’t find a way to get this response header data.
I only find one method "HeadersReceived"in the HTTPSockets. With this I can display a URL and the HTTP status. But how do I get the content of the headers?
[I need the content of the headers, because I get a token from the web server in this header. The token ist not in the url and not in the http status.]
Are you using classic sockets or Xojo.Net.HTTPSocket
I’m using the Xojo.Net.HTTPSocket.
You cant get them all, but you can use the ResponseHeader method to get individual ones.
thank you, that helps me. I think I found my problem:
If I use the “token” hardcoded, it works, e.g. this:
RSocket_Anlegen.RequestHeader("X-CSRF-TOKEN") = "mzmz842len53yghDus81Gg=="
But when I try to use a variable in the RequestHeader I got an error.
“There is more than one item with this name and its not clear to which is refers.”
var mytoken as text = "mzmz842len53yghDus81Gg=="
RSocket_Anlegen.RequestHeader("X-CSRF-TOKEN") = chr(34) + mytoken + chr(34)
so, the really problem is, how to use a variable in requestheader.
Well first of all, get rid of the chr(34) calls. You dont need those and they return Strings anyway.