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

Is it possible to ignore security certificate error? #15

Closed
danielabar opened this issue Sep 24, 2015 · 5 comments
Closed

Is it possible to ignore security certificate error? #15

danielabar opened this issue Sep 24, 2015 · 5 comments

Comments

@danielabar
Copy link

Is it possible to tell bench-rest to ignore server security certificate errors?
For example, to pass strictSSL : false to the request options?

@jeffbski
Copy link
Owner

yes, you can include properties that mikeal/request allows for tuning your requests. I pass through all the properties.

https://github.com/request/request

strictSSL - If true, requires SSL certificates be valid.

So if you add strictSSL: false it should do just what you want.

@danielabar
Copy link
Author

Thank you very much for quick response. Where would I specify the property? I tried adding it to runOptions but didn't seem to have any effect:

var benchrest = require('bench-rest');
var flow = 'https://some.api.with.self.signed.cert';

module.exports = flow;

var runOptions = {
  limit: 10,      // concurrent connections
  iterations: 20,  // number of iterations to perform
  strictSSL : false 
};

benchrest(flow, runOptions)
 .on('error', function (err, ctxName) { console.error('Failed in %s with err: ', ctxName, err); })
 .on('end', function (stats, errorCount) {
   console.log('error count: ', errorCount);
   console.log('stats', stats);
 });

The output shows error for each request like this:

Failed in main with err:  { [Error: unable to verify the first certificate] code: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE' }

@jeffbski
Copy link
Owner

Try using the object style for flow definition which allows you to specify properties for each request.

var flow = {
    main: [
      { get: 'http://localhost:8000/foo', strictSSL: false }
    ]
};

Each object in the main array is passed to request so you can add any additional options to each.

@danielabar
Copy link
Author

That works. Thank you so much for your help!

@jeffbski
Copy link
Owner

Awesome! I'm glad I was able to help. Have a great day.

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

No branches or pull requests

2 participants