question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

cannot add CA to request

See original GitHub issue

looking at: https://github.com/visionmedia/superagent/blob/master/test/node/https.js is see that superagent supports providing the CA during the request

  request
      .get('https://localhost:8443/')
      .ca(cert)

but this is not possible in supertest

var requestHttps = require('supertest')('https://localhost:8002');
  requestHttps
                .get('/')
                .ca(fs.readFileSync('test/data/SSL/dev-client.crt'))

returns TypeError: Object #<Test> has no method ‘ca’

Maybe i’m missing something, but to me this could be bug.

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
gjohnsoncommented, Jun 4, 2014

Well you need to check that in the callback… You can use supertest, the key is using the .agent() method.

var request = require('supertest');
var agent = request.agent('https://localhost:8002');

agent
  .get('/')
  .ca(fs.readFileSync('test/data/SSL/dev-client.crt'))
  .expect(200)
  .end(function(err, res){
    // check server `res` here 
  });
0reactions
DMJ92commented, Jun 18, 2020

I am getting below error “fs.readFileSync is not a function error” what could be an issue? @MiroRadenovic

Read more comments on GitHub >

github_iconTop Results From Across the Web

CA doesn't publish certificates in trusted domain
By default, it should be in place. Open the Certification Authority snap-in, right-click the CA, and then select Properties. On the Security ...
Read more >
cannot add CA to request · Issue #136 · ladjs/supertest - GitHub
Is there a way to pass in an HTTP server and the CA cert? var agent = request.agent(server); agent.get('/').ca(caRootCertificate);.
Read more >
I am having trouble adding client certificates - Postman
Go to Settings > Certificates and add the correct client certificate file (PEM for CA certificates, CRT, KEY, or PFX for self-signed ...
Read more >
Add certificates to a keychain using Keychain Access on Mac
In the Keychain Access app on your Mac, select either the login or System keychain. Drag the certificate file onto the Keychain Access...
Read more >
Add & remove certificates - Pixel Phone Help - Google Support
Add & remove certificates ... Can't find the “Do not validate” option ... Ask the Help Community Get answers from community experts.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found