-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
http not posting data in node #3
Comments
@geddski you will need to specify the request method. If it's not specified it will default to axios({
url: 'http://requestb.in/ubgv1aub',
data: { test: true },
method: 'post'
});
// or
axios.post('http://requestb.in/ubgv1aub', { test: true }); |
@geddski actually it looks like something is broken. Requests against my local server worked. Trying RequestBin I am getting 0 bytes transferred (I assume you're seeing the same). I will take a look at it tonight. |
@geddski, I looked into this and I believe it's an issue with RequestBin. First of all, when I try to post, I get a 503 from RequestBin which means "Service Unavailable." I used a different service called apiary.io and it works great. Try this: var axios = require('axios');
var URL = 'http://kentcdodds.apiary-mock.com/random-user';
var BODY = {
firstName: 'Joe',
lastName: 'Moe'
};
function handleSuccess(data) { console.log(data); }
function handleFailure(data) { console.log('error', data); }
// GET
axios.get(URL, { params: BODY })
.then(handleSuccess)
.catch(handleFailure);
// POST
axios.post(URL, BODY)
.then(handleSuccess)
.catch(handleFailure); This worked for me... |
@kentcdodds maybe requestbin just requires an accurate content length, other services might as well |
oh, is that the problem?
|
@kentcdodds @geddski I just added the |
@kentcdodds @geddski I've fixed the issue with |
Nice
|
Sweet, nice work!! — On Tue, Sep 16, 2014 at 6:33 PM, Kent C. Dodds notifications@github.com
|
@mzabriskie It started working once i manually specified |
successfully posts but the request body is empty. Probably missing some headers, but setting Content-Type and Content-Length manually cause axios to hang for some reason.
The text was updated successfully, but these errors were encountered: