GithubHelp home page GithubHelp logo

Comments (11)

novotnej avatar novotnej commented on July 19, 2024 1

ok did some digging around on the server side.
in the app I was using the non-www version, which does re-direct to the www. version.

which is fine for GET and apparently it is default behavior to send a GET request to the redirected site instead of sending the same POST request, but to a different URL..

Well, sorry for wasting your time with this, but at least it pointed me in the right direction, I would've been looking for this for a while... :D

from apisauce.

skellock avatar skellock commented on July 19, 2024

Hmm... I mean, your code looks totally normal. You might be able to log with console.dir(response).

The data: "GET" seems a bit strange to me though. Unless that's what you're returning back from the server.

That config object will contain the headers that were sent to the server for your request. Have a look inside there.

Also, do you have any request or response transforms? Are you setting a header when you create the api object?

from apisauce.

novotnej avatar novotnej commented on July 19, 2024

yeah I know, that's what strikes me as odd as well, but there is no way the server returned that. The only possilbe outcomes are

  • code 200, content-type: application/json; charset=utf-8
  • code 500, some html message
  • code 404 with HTML error

in the config object the headers are
Accept:"application/json"
Content-Type:"application/json"

and I commented out all response or request transforms when I started suspecting something might be wrong there...

from apisauce.

skellock avatar skellock commented on July 19, 2024

If you're using React Native, what version are you using? and what simulator os version? Version 0.8 of apisauce?

from apisauce.

novotnej avatar novotnej commented on July 19, 2024

hmm, no, strangely ignite generated it with:
"react-native": "0.38.0",
"apisauce": "^0.6.0",

I'll try to upgrade the version and get back to you on this

from apisauce.

skellock avatar skellock commented on July 19, 2024

Upgrading an existing project passed 0.40.0 is a bit of a bear. Check out https://twitter.com/skellock/status/818813810781908992 for some tips.

You should be able to upgrade apisauce to 0.8.0 without any stress.

from apisauce.

novotnej avatar novotnej commented on July 19, 2024

upgraded apisauce to 0.8.0 and still the same thing..

from apisauce.

skellock avatar skellock commented on July 19, 2024

Don't forget to triple backtick your comments here.

{
  "hello": "there"
}

image

from apisauce.

skellock avatar skellock commented on July 19, 2024

I'd love to see the full response object. Are you able to run this in Reactotron or Chrome Debugger so we can see the full request? (don't forget to xxxxx out any sensitive creds before posting here)

from apisauce.

novotnej avatar novotnej commented on July 19, 2024

aaaah.. I finally got to the bottom of it, kinda.. the data: "GET" was actually what the server responded, when it was accessed using unsupported method..

so the problem now is - why does this request get sent as GET, instead of POST?

can't run reactotron, it's a bit troublesome on Linux I'm afraid :/ but here's what I see:
screenshot from 2017-02-06 14 51 00

from apisauce.

skellock avatar skellock commented on July 19, 2024

The method is set to post though.

image

Do you think that your server might be expecting POST instead of post?

And that URL is the same one you're using in postman eh?

from apisauce.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.