Difference between http.get and http.request #452
Replies: 3 comments
-
Posted at 2015-09-22 by @gfwilliams Try:
I think the issue is that the path isn't specified, so it's asking the server for a page called If you used
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. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-09-22 by Tobbe Yes, please do update the docs :) The whole options object could use some documentation improvements :) Just noticed that for http.request it says
And for url.parse it says
So url.parse returns a bunch of options (pathname, search, query) not mentioned as supported in http.request (or http.get) Could you please try to clarify that? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-09-22 by @gfwilliams Yes, There are a bunch of examples under the |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-09-21 by Tobbe
I had problems doing a POST, so I started playing around with http.request and noticed that it behaves differently from http.get. Why is that?
This is the code I have
Calling getDataUsingGet() I get the same reply as I do when I visit using my web browser. But calling getDataUsingRequest() I get
And changing
method: 'get'
tomethod: 'GET'
the reply I receive isHow can I use http.request to get the same page as http.get() gets me? Why do I get different responses when using 'get' and 'GET'?
Beta Was this translation helpful? Give feedback.
All reactions