I think the issue is that the path isn't specified, so it's asking the server for a page called "", which it complains about.
If you used var options = url.parse('http://example.com') it'd neatly populate everything you need for you.
Why do I get different responses when using 'get' and 'GET'?
Because that string is being sent to the HTTP server as-is, and the HTTP server is case-sensitive. Espruino doesn't convert it to upper-case for you just in case you're trying to do something non-standard with an HTTP server.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Try:
I think the issue is that the path isn't specified, so it's asking the server for a page called
""
, which it complains about.If you used
var options = url.parse('http://example.com')
it'd neatly populate everything you need for you.Because that string is being sent to the HTTP server as-is, and the HTTP server is case-sensitive. Espruino doesn't convert it to upper-case for you just in case you're trying to do something non-standard with an HTTP server.
I'll add something to the docs on it.