Dojo issues a GET request whenever there is a 301 persistent redirect response to any HTTP method

My web application works as follows:

  • / abc / xyz: response 301 permanent redirect Location: / abc / xyz /
  • / abc / xyz /: corresponding response based on the requested HTTP method

Now when I issue the request as follows:

dojo.xhr('PUT', {url : "/abc/xyz"})

The sequence of operations is performed automatically:

  • PUT request is sent
  • Received 301 Permanent Redirects
  • A GET request is sent to the new URL / abc / xyz /

I do not understand why this is happening. I do not want dojo.xhr to be so smart. I want him to just focus on the 301 permanent redirect response and let me take care of how to handle permanent redirects. I would rather update the url and send a new PUT request in this case. The situation is the same for all other HTTP methods like OPTIONS, etc. I used PUT in the above example as an example.

Is there a way to configure dojo.xhr to behave this way?

+3
source share
2 answers

If you really do not need to follow 301, you can create a server-side gateway that returns a notification that 301 has been received instead of following it.

PHP . . http://php.net/manual/en/ref.curl.php get_url

0

All Articles