Reputation: 31
I am trying to make an POST call in node JS using the HEADERS, BODY. While i tried in Chrome "Advanced Rest Client" posted the URL with Request Headers, Body etc and i got the response message as 200 OK.
but the same request i tried in node js as given below
http.request({
host: "http://somesite.com",
path: "/path/name/",
port: 80
method: "POST"
...
})
when i run it, i get the following error
Error: getaddrinfo ENOTFOUND http://somesite.com http://somesite.com:80
at errnoException (dns.js:27:10)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:78:26)
can anyone solve my issue.
Upvotes: 1
Views: 976
Reputation: 106746
The host
value is to be the host name only (the value is resolved by the DNS client and used in the Host:
HTTP header). In your case this would just be: host: "somesite.com"
Upvotes: 2