Skip to content
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

Usage of post #20

Closed
petermilan opened this issue Jun 19, 2014 · 2 comments
Closed

Usage of post #20

petermilan opened this issue Jun 19, 2014 · 2 comments
Assignees
Labels
bug
Milestone

Comments

@petermilan
Copy link

@petermilan petermilan commented Jun 19, 2014

Could you please add example of usage of Nipple.post? I tried to use it like this:

var uti = 'http://uri.com';
var options = {
  payload: JSON.stringify(data),
  json: true
};
Nipple.post(uri, options, function(err, res, payload) {

})

which seems to work in most cases, but if data contains some strange character it will throw an error:

{ [Error: Client request error: socket hang up]
  code: 'ECONNRESET',
  trace: [ { method: 'POST', url: 'http://luri.com' } ],
  isBoom: true,
  data: null,
  output: 
   { statusCode: 502,
     payload: 
      { statusCode: 502,
        error: 'Bad Gateway',
        message: 'socket hang up' },
     headers: {} },
  reformat: [Function] }

I figured out that the strange character is "ć".

How should the post method be called correctly?

@hueniverse

This comment has been minimized.

Copy link
Member

@hueniverse hueniverse commented Jun 19, 2014

Try making the same request with the request module and see what happens.

@petermilan

This comment has been minimized.

Copy link
Author

@petermilan petermilan commented Jun 23, 2014

Hello, I've tried:

var request = require('request');
//data.field = "ć";
request.post(uri,{form: data}, function(error, response, body) {
});

And this worked for me.

@nlf nlf closed this in a3db17f Aug 3, 2014
hueniverse added a commit that referenced this issue Aug 3, 2014
allow for unicode characters in string payloads, closes #20
@hueniverse hueniverse added the bug label Aug 3, 2014
@hueniverse hueniverse modified the milestones: 2.5.5, 2.5.4 Aug 3, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.