Ionic3 with woocommerce rest api having post request?

后端 未结 1 1474
说谎
说谎 2020-12-12 06:56

I am new to both woocommerce and Ionic and am trying to create an application with woocommerce as backend I have implemented the get request based rest apis in project but a

相关标签:
1条回答
  • 2020-12-12 07:34

    This is the way CORS works (when using cross domain requests). With CORS, the remote Web application (here the one with domain mydomain.org) chooses if the request can be served thanks to a set of specific headers.

    The CORS specification distinguishes two distinct use cases:

    Simple requests. This use case applies if we use HTTP GET, HEAD and POST methods. In the case of POST methods, only content types with the following values are supported: text/plain, application/x-www-form-urlencoded and multipart/form-data.

    Preflighted requests. When the ‘simple requests’ use case doesn’t apply, a first request (with the HTTP OPTIONS method) is made to check what can be done in the context of cross-domain requests. It's not Angular2 that sends the OPTIONS request but the browser itself. It's not something related to Angular.

    For more details, you could have a look at this article:

    http://restlet.com/blog/2015/12/15/understanding-and-using-cors/

    0 讨论(0)
提交回复
热议问题