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

signRequest doc change maybe #737

Closed
cmawhorter opened this issue Jan 14, 2015 · 1 comment
Closed

signRequest doc change maybe #737

cmawhorter opened this issue Jan 14, 2015 · 1 comment
Labels

Comments

@cmawhorter
Copy link

signRequest is a sync callback that passes an http.ClientRequest (writable stream).

Unless I'm mistaken, this means that the body is not exposed unless you create the client and request in the same scope like so:

function makeRequest(data) {
  var client = restify.createJsonClient({
    url: 'http://localhost:3000',
    signRequest: function(req) {
      var body = JSON.stringify(data);
      req.setHeader('authorization', someSigner(headers + body));
    }
  });

  client.post('/foo', data, function(err, req, res, obj) {
    assert.ifError(err);
    console.log('%d -> %j', res.statusCode, res.headers);
    console.log('%j', obj);
  });
};

makeRequest({ hello: 'world' });

Might be noteworthy in the docs.

@retrohacker
Copy link
Member

retrohacker commented Apr 29, 2017

Hey @cmawhorter,

Thank you for taking the time to open this issue, sorry it took so long for you to get a response.

I've tagged this as a documentation improvement and we will need to see if it is still relevant in the upcoming 5.x release. ❤️

retrohacker pushed a commit that referenced this issue Apr 29, 2017
Closes:

#289
#381
#474
#575
#790
#633
#717
#576
#576
#909
#875
#860
#853
#850
#829
#813
#801
#921
#1101
#1019
#989
#632
#708
#737
#859
#1326
#1327
#927
#1099
#1068
#1040
#1035
#957
#948
#1134
#1136
#1183
#1206
#1286
#1323

> Note: this issue closes _but does not resolve_ the issues listed, we are just tracking them in another medium
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants