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

rejectUnauthorized not work for me #531

Closed
xiaomengheiheihei opened this issue Sep 4, 2024 · 3 comments · Fixed by #561
Closed

rejectUnauthorized not work for me #531

xiaomengheiheihei opened this issue Sep 4, 2024 · 3 comments · Fixed by #561
Assignees
Labels
bug Something isn't working

Comments

@xiaomengheiheihei
Copy link

The usage version is as follows:

"name": "urllib",
"version": "3.18.1",

code

import { request, ProxyAgent } from 'urllib';

let res = await request(url, {
    timeout,
    method,
    headers: headers,
    data: query,
    gzip: true,
    rejectUnauthorized: false,
    dispatcher: proxyAgent ? proxyAgent : null
  });

Still reporting errors :UNABLE_TO_VERIFY_LEAF_SIGNATURE

@fengmk2
Copy link
Member

fengmk2 commented Sep 16, 2024

能否提供一个可复现的代码?

@fengmk2
Copy link
Member

fengmk2 commented Dec 7, 2024

需要单独创建一个 httpClient 实例,不能使用全局的

const httpclient = new HttpClient({
      connect: {
        rejectUnauthorized: true,
      },
    });

@fengmk2 fengmk2 self-assigned this Dec 7, 2024
@fengmk2 fengmk2 added the bug Something isn't working label Dec 7, 2024
@fengmk2
Copy link
Member

fengmk2 commented Dec 7, 2024

我增加一个方式兼容一下

fengmk2 added a commit that referenced this issue Dec 7, 2024
)

closes #531

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

## Release Notes

- **New Features**
- Enhanced HTTP client configuration with options for handling HTTP/2
and unauthorized requests.
- Introduced new tests for validating behavior with `rejectUnauthorized`
set to false.

- **Bug Fixes**
  - Improved error handling and address validation in HTTP client tests.

- **Documentation**
- Updated comments for clarity and consistency in the `HttpClient`
class.

- **Chores**
- Updated dependency management for improved security and functionality.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants