Comments (11)
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.
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.
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.
If you're using React Native, what version are you using? and what simulator os version? Version 0.8 of apisauce?
from apisauce.
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.
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.
upgraded apisauce to 0.8.0 and still the same thing..
from apisauce.
Don't forget to triple backtick your comments here.
{
"hello": "there"
}
from apisauce.
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.
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:
from apisauce.
The method is set to post
though.
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)
- CORS errors HOT 2
- Retry with new config HOT 1
- Cannot read properties of undefined (reading 'status') HOT 7
- Request sends Twice returns HTTP 500 Error HOT 2
- doesn't support formData HOT 4
- How to add file CA Certificate https?
- Question about response type declaration HOT 5
- Vulnerability introduced by package follow-redirects HOT 1
- Do I Need To Set Headers Max-Age?
- is there any schedule to upgrade the axios? HOT 4
- Latest version support for Axios ? HOT 2
- addAsyncRequestTransform not tiggering in iOS
- Remove request/response transform. HOT 1
- got 2 test case failed in unit test HOT 1
- TypeError: axios.create is not a function error HOT 3
- Upload image not working on 3.0.1 HOT 3
- error TypeError: axios.isCancel is not a function HOT 1
- create is not a function HOT 3
- Weird behaviour with urls after updating to Xcode 15 HOT 6
- Is there a way to redo a request if failed?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from apisauce.