Http-Method changes from POST to OPTIONS when changing Content-Type

后端 未结 3 1320
-上瘾入骨i
-上瘾入骨i 2021-01-13 22:27

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

3条回答
  •  不知归路
    2021-01-13 22:42

    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.

提交回复
热议问题