0

So I've made this .net core api. And have a weird issue.

When I make a request it works and I get correct data back. Then, when I do exactly the same request, I get an 405 (Method not Allowed).

So I thought I capture the method in a custom error page to see what it captures.

await context.HttpContext.Response.WriteAsync(
                    "Status code page 405, Method: " + context.HttpContext.Request.Method);

Now the weird part. For the succesfull request it captures "GET", for the failed request it captures "T" (just 1 letter). While the request are exactly the same.

How on earth is this possible??

See this: [![enter image description here][1]][1]

NLAnaconda
  • 1,255
  • 2
  • 11
  • 24
  • 2
    Have you looked at [Alamofire](https://github.com/Alamofire/Alamofire/issues?utf8=%E2%9C%93&q=is%3Aisue+405)? Seems you are not alone. Have you tried to sniff traffic using `wireshark`? By the way accepting body in GET requests is [not a good idea](https://stackoverflow.com/a/983458/780798). – stukselbax Aug 07 '19 at 19:10
  • @stukselbax thanks for pointing me out in the right direction! I'm working on the Api side and it seems to be an bug in Alamofire which is the app side. This is probably the reason that it only happens in the iOS app. (The body is the response. The request doesn't have a body) – NLAnaconda Aug 07 '19 at 19:15
  • 1
    Also seems it is [already asked](https://stackoverflow.com/questions/48654888/it-shows-405-server-error-at-first-time-to-get-result-from-api-server-and-it-wo?rq=1). – stukselbax Aug 07 '19 at 19:17

0 Answers0