POST and PUT fetch requests fail on Android but not on iOS


#1

Anybody faced an issue where a standard fetch request fails on Android (both a Genymotion simulator and an actual device)? All calls succeed on iOS. The error returned by the server is:

"_bodyInit": "<?xml version=\"1.0\" encoding=\"utf-8\"?><Error><Code>UnsupportedHttpVerb</Code><Message>The resource doesn't support specified Http Verb.
RequestId:26f262ac-001e-0078-421e-8950de000000
Time:2018-01-09T07:50:44.3008495Z</Message></Error>",
  "_bodyText": "<?xml version=\"1.0\" encoding=\"utf-8\"?><Error><Code>UnsupportedHttpVerb</Code><Message>The resource doesn't support specified Http Verb.
RequestId:26f262ac-001e-0078-421e-8950de000000
Time:2018-01-09T07:50:44.3008495Z</Message></Error>",
  "headers": Headers {
    "map": Object {
      "allow": Array [
        "GET,HEAD,PUT,DELETE",
      ],
      "cache-control": Array [
        "public, max-age=0",
      ],
      "content-length": Array [
        "237",
      ],
      "content-type": Array [
        "application/xml",
      ],
      "date": Array [
        "Tue, 09 Jan 2018 07:50:43 GMT",
      ],
      "expires": Array [
        "-1",
      ],
      "server": Array [
        "Microsoft-HTTPAPI/2.0",
      ],
      "x-aspnet-version": Array [
        "4.0.30319",
      ],
      "x-ms-request-id": Array [
        "26f262ac-001e-0078-421e-8950de000000",
      ],
      "x-powered-by": Array [
        "ASP.NET",
      ],
    },
  },
  "ok": false,
  "status": 405,
  "statusText": undefined,
  "type": "default",

Basically this happens with anything requiring a body to be sent in the request and only from Android. I’m certain (even though the above response says differently) that POSTS are allowed as I can do so from Postman and iOS devices. Additionally, I thought perhaps it was a CORS issue so I made that wide open as well. Finally I’ve tried it against other services and I get the same. I’ve been struggling with this all day and am hoping somebody might have some guidance.

Thanks!

Roland


#2

Hi, Roland!

Though you’ve already ruled it out in this case, one thing I can say for the future is that the problem will never be CORS; it’s only a consideration when fetching from a browser’s javascript runtime, not in an expo app.

Are you specifying the http verb in your calls to fetch? Can you post (pun unavoidable, sorry) an example of a call that fails? Anonymized as needed, of course.


#3

Thanks for reaching out Nick. I wasn’t able to actually figure out the issue but my Azure Functions were written in Node. I rewrote them in C# and magically all was good without me having to change my react-native code. Go figure. Not sure what is so different between the C# and node public web service interfaces on the Microsoft stack that cause it to reject the calls from Android but after a quick port of all my services I’m all good now!


closed #4

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.