I am using closure library to do a simple POST. I think XhrIo should work because from my machine when I use any other rest client ,like Firefox browser app RESTClient or Ch
If you are pass Content-Type
on authorization
request it will convert POST
method to OPTIONS
method so while we are use ouath and passing authorization token that time do not required Content-Type
.
So do not pass Content-Type
on all authorization
request it won't change your method POST
to OPTIONS
When you add a header to an XHR object, most browsers will do a preflight request, which is the OPTIONS
method that you are seeing. There is not a way to circumvent this if you are adding custom headers, unfortunately. The POST
will be sent after the OPTIONS
.
This article explains the OPTIONS
request a bit. I ran into issues with the preflight a while back, if that is any help.
If you have specific issues with the OPTIONS
request you should edit your question to include them; otherwise, this is expected behavior.
FWIW mine also failed to update the type when I specified...
{'content-type':'application/json'}
However, if I corrected the case to
{'Content-Type':'application/json'}
... it worked.
Go figure.