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

Add certificate options for requests #66

Closed
geek opened this issue Oct 31, 2014 · 4 comments
Closed

Add certificate options for requests #66

geek opened this issue Oct 31, 2014 · 4 comments
Assignees
Labels
Milestone

Comments

@geek
Copy link
Member

@geek geek commented Oct 31, 2014

@geek geek added the feature label Oct 31, 2014
@geek geek added this to the 6.0.0 milestone Oct 31, 2014
@geek geek self-assigned this Oct 31, 2014
@geek geek added request and removed feature labels Nov 17, 2014
@geek geek removed this from the 5.1.0 milestone Nov 17, 2014
@geek geek removed their assignment Nov 17, 2014
@achingbrain

This comment has been minimized.

Copy link

@achingbrain achingbrain commented Jun 16, 2015

I'm trying to convert some code that uses request to Wreck to take advantage of the good integration. The service we are talking to needs client certificates sent so this would be super useful.

@achingbrain

This comment has been minimized.

Copy link

@achingbrain achingbrain commented Jun 24, 2015

For anyone else with the same problem, I managed to specify client certificates by overriding Wreck's default https agent:

var Wreck = require('wreck');
var https = require('https');

Wreck.agents.https = new https.Agent({
  cert: ...,
  key: ...,
  ca: ...,
  ...
});

// now make a request as usual
Wreck.request('GET', 'https://...', ...);

Wreck is a singleton so these options will be applied to all outgoing requests no matter where you require Wreck from.

If I wanted to vary the certs on a per-request basis I could probably have also done it by passing an agent to the request method as part of the options:

Wreck.request('GET', 'https://...', {
  agent: new https.Agent({
    ...
  });
}, ...);
@kanongil

This comment has been minimized.

Copy link
Member

@kanongil kanongil commented Jun 25, 2015

You could use the new defaults() method to handle this, avoiding interference of other modules wreck usage. Eg.:

var wreck = Wreck.defaults({ agent: agent });
wreck.request(…);

Note that this will fail until #93 is resolved, if you use redirects.

@nlf

This comment has been minimized.

Copy link
Member

@nlf nlf commented Mar 21, 2017

sounds like this can probably be documented and closed?

@geek geek added documentation and removed request labels Mar 21, 2017
@geek geek added this to the 11.0.0 milestone Mar 21, 2017
@geek geek self-assigned this Mar 21, 2017
@geek geek closed this in #159 Mar 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.