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

Equivalent of https.agent #1810

Open
Shahanshah-TA opened this issue Jul 12, 2024 · 0 comments
Open

Equivalent of https.agent #1810

Shahanshah-TA opened this issue Jul 12, 2024 · 0 comments
Labels

Comments

@Shahanshah-TA
Copy link

Describe the bug

Node.js version: 21.6.2

OS version: MacOS sonoma 14.5

Description:
Hi
I need to send certificate in api request, so I was trying with axios but new https.agent({}) is not supported by React Native as it is a Node API.
Is there any way I can use this package to fix this issue?

Actual behavior

Getting error This is not supported in browser version of superagent

Expected behavior

It should complete the request.

Code to reproduce

try {
    superagent
      .put(
        `myURL`,
      )
      .send({registrationId: registrationId}) // sends a JSON post body
      .set('Content-Type', 'application/json')
      .set('Content-Encoding', 'utf-8')
      .agent({
        cert: cert,
        key: key,
      })
      .end((err, res) => {
        if (err) {
          console.log('err', err);
        } else {
          console.log('res', res);
        }
        // Calling the end function will send the request
      });
  } catch (err) {
    console.log('err', err);
  }

Checklist

  • [✓] I have searched through GitHub issues for similar issues.
  • [✓] I have completely read through the README and documentation.
  • [✓] I have tested my code with the latest version of Node.js and this package and confirmed it is still not working.
    Thank you
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

1 participant