question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Post request gives "GET" as response.data

See original GitHub issue

Hi, I’ve been struggling with this for a while and can’t seem to find a solution.

I am sending this request:

//Service
const postPasswordLogin = function (email, password, deviceId, deviceType) {
    var data = {email, password, deviceId, deviceType};
    return api.post('/sign-in/password', data);
  };
//Saga
const response = yield call(api.postPasswordLogin, email, password, 'alibaba', 'android');
console.log(response);

but I keep getting a response like this:

Object
config:Object
data:"GET"
duration:1177
headers:Object
ok:true
problem:null
status:200

if I test the API request with postman using the same JSON object as I see in config and with application/json headers, server responds just fine. With apisause it seems like it’s attempting to send some kind of error (because response header is text/html instead of JSON), but such error won’t have a 200 status code and definitely will have some response…

any ideas?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
novotnejcommented, Feb 6, 2017

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… 😄

0reactions
skellockcommented, Feb 6, 2017

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?

Read more comments on GitHub >

github_iconTop Results From Across the Web

javascript - Make a correct POST request and get response data
And my front-end part of application should send a POST request with a data and get a response. I am trying to use...
Read more >
HTTP Methods GET vs POST - W3Schools
HTTP works as a request-response protocol between a client and server. ... GET is used to request data from a specified resource.
Read more >
GET vs POST - Difference and Comparison | Diffen
HTTP POST requests supply additional data from the client (browser) to the server in the message body. In contrast, GET requests include all...
Read more >
Understanding Axios POST requests - LogRocket Blog
Learn how to use the Axios POST method in both vanilla JavaScript and in a framework like React to send requests.
Read more >
POST Request in Postman - Javatpoint
The post is an HTTP method like GET. We use this method when additional information needs to be sent to the server inside...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found