[Gambas-user] CURL: Custom outgoing headers
Shannon Smith
shannon at ...2384...
Sat Mar 6 20:00:53 CET 2010
I'm trying to connect to a server that requires a custom header. I'm using
CURL and Gambas v2.13. I can't find a way to modify the outgoing headers.
Here's my code snippet:
DIM mySock AS HttpClient
DIM myResponse AS String
DIM myRequest AS String
DIM AuthToken as String
AuthToken = "TESTTOKEN"
mySock = NEW HttpClient
myRequest = makeJSON(TextBox1.Text, myParent)
MySock.Async = FALSE
MySock.Timeout = 60
mySock.url = "http://www.zenfolio.com/api/1.2/zfapi.asmx"
MySock.Headers = ["X-Zenfolio-Token: " & AuthToken]
MySock.Post("application/json", myRequest)
--
When I send this to a port listener (rather than the zenfolio url above) I
see it is only sending the following:
POST / HTTP/1.1
User-Agent: Gambas Http/1.0
Host: localhost:8080
Accept: */*
Content-Type: application/json
Content-Length: 126
{"method": "CreateGroup", "params": [164023293, {"Title": "TextBox1",
"Caption": "TextBox1", "CustomReference": ""}], "id": 1}
(Obviously, I changed the host to my localhost to listen).
The Headers are not being sent. Is there a way to send custom headers,
without resorting to creating my own function with gb.net?
Thanks in advance!
Shan
More information about the User
mailing list