I am trying to authenticate through a server using a json request, but in order for the server to not throw a 400 I need to include request headers.
for example
curl -v -H "Content-Type: application/json; charset=utf-8" -d ‘{“Username”:”foo”,”Pw”:”bar”}’ http://localhost:port/Users/authenticatebyname
will throw a 400 error since it doesn’t have all the request headers. Along with an error in terminal with curl: (3) URL using bad/illegal format or missing URL
but whenever I try to add ANY other headers like this
curl -v —H “Accept-Encoding: gzip, deflate” -H “Priority: u=1” -H "Content-Type: application/json; charset=utf-8" -d ‘{“Username”:”foo”,”Pw”:”bar”}’ http://localhost:port/Users/authenticatebyname
it will completely ignore the accept-encoding and priority headers and will instead throw back
* Closing connection 0
curl: (6) Could not resolve host: —H
* Closing connection -1
curl: (3) URL using bad/illegal format or missing URL
* Closing connection -1
curl: (3) URL using bad/illegal format or missing URL
* Could not resolve host: deflate”
* Closing connection 1
curl: (6) Could not resolve host: deflate”
* Closing connection -1
curl: (3) URL using bad/illegal format or missing URL
* Closing connection -1
curl: (3) URL using bad/illegal format or missing URL
and THEN throw the 400 error
I am not sure if I have the original request formatted wrong with the content type header, but if I take it out it will throw a 415 since it expect a json request.
I don’t know why it’s not recognizing the other headers as headers, and throwing that curl error.