Skip to content

Use OutgoingHttpHeader type from @types/node#1779

Draft
Semigradsky wants to merge 1 commit intonode-fetch:mainfrom
Semigradsky:use-node-types
Draft

Use OutgoingHttpHeader type from @types/node#1779
Semigradsky wants to merge 1 commit intonode-fetch:mainfrom
Semigradsky:use-node-types

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.

['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.

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

['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