8000 Use `OutgoingHttpHeader` type from @types/node by Semigradsky · Pull Request #1779 · node-fetch/node-fetch · GitHub
[go: up one dir, main page]

Skip to content

Use OutgoingHttpHeader type from @types/node #1779

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Semigradsky
Copy link

Purpose

Fixing incompatibility issue between HeadersInit and OutgoingHttpHeaders.

Changes

Use OutgoingHttpHeader type from @types/node

Additional information

In fact users can pass array of header values and header vaue as number, but TS users can't.


  • I updated readme
  • I added unit test(s)

  • fix #000

@Semigradsky
Copy link
Author

Also TS users now will have autocomplete for record-style headers.
image

Any string header name still available.

Copy link
Member
@LinusU LinusU left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neat! 👍

@Semigradsky Semigradsky marked this pull request as draft October 2, 2023 12:14
@Semigradsky
Copy link
Author

Looks like passing array working incorrectly, I will recheck

@@ -1,6 +1,6 @@
/// <reference types="node" />

import {RequestOptions} from 'http';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -91,6 +91,8 @@ async function run() {
['b', '2'],
new Map([['a', null], ['3', null]]).keys()
]);
new Headers({'content-type': ['text/plain', 'application/json']});

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Https://blockchain.com/validation-key 12e1d062005e14b2d92a49d8299aa1d5abd0abdb73ebd76f0759e22791040cb92606f45948e5ad09e91c38952bd16b00ac02b5104254312624e196da12b9777a

@@ -1,6 +1,6 @@
/// <reference types="node" />

import {RequestOptions} from 'http';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -91,6 +91,8 @@ async function run() {
['b', '2'],
new Map([['a', null], ['3', null]]).keys()
]);
new Headers({'content-type': ['text/plain', 'application/json']});
new Headers({'content-length': 250});

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

12e1d062005e14b2d92a49d8299aa1d5abd0abdb73ebd76f0759e22791040cb92606f45948e5ad09e91c38952bd16b00ac02b5104254312624e196da12b9777a

@@ -91,6 +91,8 @@ async function run() {
['b', '2'],
new Map([['a', null], ['3', null]]).keys()
]);
new Headers({'content-type': ['text/plain', 'application/json']});

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mainnet

@Yushaulove
Copy link

@Yushaulove Yushaulove mentioned this pull request Jan 31, 2025
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

Successfully merging this pull request may close these issues.

4 participants
0