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

Adding the ability to add a custom https agent. #163

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rashthedude
Copy link

We have a requirement such that we need to make non standard HTTPS calls. We need to alter the https agent and pass information on where to read the cert, ca and cert files are not provided by the connection.

An example use case is as follows

options = {
        hostname: parsed.hostname,
        port: parsed.port,
        path: parsed.path,
        method: 'POST',
        key: fs.readFileSync('/var/www/apps/custom/current/config/certs/custom.key'),
        cert: fs.readFileSync('/var/www/apps/custom/current/config/certs/custom.crt')
        ca: fs.readFileSync('/var/www/apps/custom/current/config/certs/customca.crt')
 }
agent = new https.Agent(options)

restler.post(@mtUrl, {data: params, agent: agent}).on 'success', function(data, resp) {
  // bla bla
})

The pull request is super simple so would be excellent if you could merge it in.

@stowns
Copy link

stowns commented Apr 2, 2014

+1

@easternbloc
Copy link
Collaborator

This would fix #81

@easternbloc
Copy link
Collaborator

Can you add a test?

@sesposito
Copy link

This would be great

@rashthedude
Copy link
Author

I will add necessary tests.

@sesposito
Copy link

Any progress?

@rashthedude
Copy link
Author

Sorry, but due to work commitments have I not been able to write the necessary tests. Should hopefully have them ready for the weekend.

@sesposito
Copy link

Maybe I can help you with the tests? I'd just need to have an example or something, because I've never done tests for node

@capablemonkey
Copy link

+1

@easternbloc
Copy link
Collaborator

@capablemonkey Happy to merge if you fancy adding some tests :)

@omichowdhury
Copy link

@easternbloc I've been struggling to figure out a way to test this change to be honest. Had a look through the current tests and I didn't see a way of testing an option. Testing setting an agent itself from the response also seems impossible. Any ideas?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants