Example Fails
Closed this issue · 1 comments
When I tried out the example through Particle's web IDE, I got this output:
Application> Start of Loop.
Application> Response status: 403
Application> HTTP Response Body:
There is no response body. curl returns a valid response, so the connection is not the issue.
After some debugging, I found out that timeapi.org expects a "User-Agent" field in the Http request. Altering the example to this...
http_header_t headers[] = {
{ "Accept" , "*/*"},
{ "User-Agent" , "A user agent."},
{ NULL, NULL }
};'
...gives output:
Application> Start of Loop.
Application> Response status: 200
Application> HTTP Response Body: 2016-12-22T18:41:00+00:00
Hi,
I've never tested with the Web IDE so it's not 'officially' supported. I'm happy to merge a PR for compatibility though!