added types to OutgoingHttpHeaders#66783
added types to OutgoingHttpHeaders#66783typescript-bot merged 7 commits intoDefinitelyTyped:masterfrom
Conversation
|
As per the discussion in #66753 |
|
@skwee357 Thank you for submitting this PR! This is a live comment which I will keep updated. 1 package in this PR
Code ReviewsBecause you edited one package and updated the tests (👏), I can help you merge this PR once someone else signs off on it. You can test the changes of this PR in the Playground. Status
All of the items on the list are green. To merge, you need to post a comment including the string "Ready to merge" to bring in your changes. Diagnostic Information: What the bot saw about this PR{
"type": "info",
"now": "-",
"pr_number": 66783,
"author": "skwee357",
"headCommitOid": "adfb3b7b9611cf6a68003e22c675d75dd9096e29",
"mergeBaseOid": "46cd17037ac5399364b0a59511d646c0dd56165a",
"lastPushDate": "2023-09-22T00:50:51.000Z",
"lastActivityDate": "2023-09-29T15:20:01.000Z",
"maintainerBlessed": "Waiting for Code Reviews",
"mergeOfferDate": "2023-09-29T03:06:27.000Z",
"mergeRequestDate": "2023-09-29T15:20:01.000Z",
"mergeRequestUser": "skwee357",
"hasMergeConflict": false,
"isFirstContribution": false,
"tooManyFiles": false,
"hugeChange": false,
"popularityLevel": "Critical",
"pkgInfo": [
{
"name": "node",
"kind": "edit",
"files": [
{
"path": "types/node/http.d.ts",
"kind": "definition"
},
{
"path": "types/node/test/http.ts",
"kind": "test"
},
{
"path": "types/node/ts4.8/http.d.ts",
"kind": "definition"
},
{
"path": "types/node/ts4.8/test/http.ts",
"kind": "test"
},
{
"path": "types/node/v16/http.d.ts",
"kind": "definition"
},
{
"path": "types/node/v16/test/http.ts",
"kind": "test"
},
{
"path": "types/node/v16/ts4.8/http.d.ts",
"kind": "definition"
},
{
"path": "types/node/v16/ts4.8/test/http.ts",
"kind": "test"
},
{
"path": "types/node/v18/http.d.ts",
"kind": "definition"
},
{
"path": "types/node/v18/test/http.ts",
"kind": "test"
},
{
"path": "types/node/v18/ts4.8/http.d.ts",
"kind": "definition"
},
{
"path": "types/node/v18/ts4.8/test/http.ts",
"kind": "test"
}
],
"owners": [
"Microsoft",
"DefinitelyTyped",
"jkomyno",
"alvis",
"r3nya",
"btoueg",
"smac89",
"touffy",
"DeividasBakanas",
"eyqs",
"Hannes-Magnusson-CK",
"hoo29",
"kjin",
"ajafff",
"islishude",
"mwiktorczyk",
"mohsen1",
"n-e",
"galkin",
"parambirs",
"eps1lon",
"ThomasdenH",
"WilcoBakker",
"wwwy3y3",
"samuela",
"kuehlein",
"bhongy",
"chyzwar",
"trivikr",
"yoursunny",
"qwelias",
"ExE-Boss",
"peterblazejewicz",
"addaleax",
"victorperin",
"ZYSzys",
"NodeJS",
"LinusU",
"wafuwafu13",
"mcollina",
"Semigradsky"
],
"addedOwners": [],
"deletedOwners": [],
"popularityLevel": "Critical"
}
],
"reviews": [
{
"type": "approved",
"reviewer": "Semigradsky",
"date": "2023-09-28T15:53:00.000Z",
"isMaintainer": false
},
{
"type": "stale",
"reviewer": "Uzlopak",
"date": "2023-09-26T17:45:01.000Z",
"abbrOid": "8bef76d"
}
],
"mainBotCommentID": 1730564460,
"ciResult": "pass"
} |
|
🔔 @microsoft @DefinitelyTyped @jkomyno @alvis @r3nya @btoueg @smac89 @Touffy @DeividasBakanas @eyqs @Hannes-Magnusson-CK @hoo29 @kjin @ajafff @islishude @mwiktorczyk @mohsen1 @n-e @galkin @parambirs @eps1lon @ThomasdenH @WilcoBakker @wwwy3y3 @samuela @kuehlein @bhongy @chyzwar @trivikr @yoursunny @qwelias @ExE-Boss @peterblazejewicz @addaleax @victorperin @ZYSzys @nodejs @LinusU @wafuwafu13 @mcollina @Semigradsky — please review this PR in the next few days. Be sure to explicitly select |
types/node/http.d.ts
Outdated
| 'content-disposition'?: string | undefined; | ||
| 'content-encoding'?: string | undefined; | ||
| 'content-language'?: string | undefined; | ||
| 'content-length'?: string | undefined; |
There was a problem hiding this comment.
number often used for 'content-length'
types/node/http.d.ts
Outdated
| interface OutgoingHttpHeaders extends NodeJS.Dict<OutgoingHttpHeader> {} | ||
| interface OutgoingHttpHeaders extends NodeJS.Dict<OutgoingHttpHeader> { | ||
| accept?: string | undefined; | ||
| 'accept-charset'?: string | undefined; |
There was a problem hiding this comment.
string[] can be used almost with all headers
There was a problem hiding this comment.
Is the same applied to IncomingHeaders? If so, I propose we match them, because as of right now, most incoming headers accept only string.
There was a problem hiding this comment.
See https://github.com/nodejs/node/blob/31e727db7e0f57bd71d35ce8c1cf378bab309b0f/test/parallel/test-http-server-multiheaders2.js#L32-L45 for multiple allowed headers list
There was a problem hiding this comment.
Is the same applied to IncomingHeaders?
Not sure, they can be received as joined string. Need testing
There was a problem hiding this comment.
Looks like only string for IncomingHeaders: https://github.com/nodejs/node/blob/31e727db7e0f57bd71d35ce8c1cf378bab309b0f/test/parallel/test-http-multiple-headers.js#L23-L29
|
@Semigradsky Thank you for reviewing this PR! The author has pushed new commits since your last review. Could you take another look and submit a fresh review? |
|
@skwee357 Unfortunately, this pull request currently has a merge conflict 😥. Please update your PR branch to be up-to-date with respect to master. Have a nice day! |
| 'content-disposition'?: string | undefined; | ||
| 'content-encoding'?: string | undefined; | ||
| 'content-language'?: string | undefined; | ||
| 'content-length'?: string | number | undefined; |
There was a problem hiding this comment.
This assumption is dangerously wrong. headers are usually strings and have to be casted manually.
There was a problem hiding this comment.
In examples and tests Node.js team often use number for 'content-length'. The same in real world. Not sure that need to break it.
There was a problem hiding this comment.
In examples:
- https://nodejs.org/dist/latest-v20.x/docs/api/http.html#responsewriteheadstatuscode-statusmessage-headers
- https://nodejs.org/dist/latest-v20.x/docs/api/http2.html#http2streamrespondwithfdfd-headers-options
In tests:
- https://github.com/nodejs/node/blob/c829c03df2451212d1d6d28e867579e5d5e4a06e/test/async-hooks/test-http-agent-handle-reuse-serial.js#L63
- https://github.com/nodejs/node/blob/c829c03df2451212d1d6d28e867579e5d5e4a06e/test/parallel/test-http-allow-content-length-304.js#L11
- https://github.com/nodejs/node/blob/c829c03df2451212d1d6d28e867579e5d5e4a06e/test/parallel/test-http-client-spurious-aborted.js#L14
- and many others...
There was a problem hiding this comment.
Ok, it will converted to string internally...
623f763 to
905f85b
Compare
|
@Uzlopak, @Semigradsky Thank you for reviewing this PR! The author has pushed new commits since your last review. Could you take another look and submit a fresh review? |
|
@Semigradsky, @Uzlopak Thank you for reviewing this PR! The author has pushed new commits since your last review. Could you take another look and submit a fresh review? |
|
@Uzlopak, @Semigradsky Thank you for reviewing this PR! The author has pushed new commits since your last review. Could you take another look and submit a fresh review? |
types/node/http.d.ts
Outdated
| 'sec-websocket-protocol'?: string | string[] | undefined; | ||
| 'sec-websocket-version'?: string | undefined; | ||
| server?: string | undefined; | ||
| 'set-cookie'?: string[] | undefined; |
There was a problem hiding this comment.
Imho set-cookie can be also a single string.
There was a problem hiding this comment.
Apologies for the back-and-forth. I'm not focused recently
|
@skwee357 Looks good! 👍 Currently you added it for Node.js v20 and TypeScript > 4.8 Need to add also
|
Done! |
|
@skwee357 The CI build failed! Please review the logs for more information. Once you've pushed the fixes, the build will automatically re-run. Thanks! Note: builds which are failing do not end up on the list of PRs for the DT maintainers to review. |
|
@Uzlopak Thank you for reviewing this PR! The author has pushed new commits since your last review. Could you take another look and submit a fresh review? |
|
Ready to merge |
It is not compatible with the |
|
@JandenMa I apologize for that. As pointed out by @Semigradsky here https://github.com/nodejs/node/blob/31e727db7e0f57bd71d35ce8c1cf378bab309b0f/test/parallel/test-http-server-multiheaders2.js#L32-L45 As a temporary solution, maybe you can force cast it to satisfy the problematic package? I would also suggest opening an issue / PR to the problematic package. |
|
@skwee357 Thanks for your response. |
|
@JandenMa what the type |
|
Ok, looks like |
|
Well I use the |
|
Do you use |
|
native one~ |
|
In this case looks like issue should be gone after #66824 when you will use types from |
|
Hmmm I don't think that's what I can control though. |
|
No, they are the same, see DefinitelyTyped/types/aws4/index.d.ts Line 38 in 5d599be |
|
Oh, it refers to the same type. |
|
Thank you @Semigradsky 😋 |


Please fill in this template.
npm test <package to test>.Select one of these and delete the others:
If adding a new definition:
.d.tsfiles generated via--declarationdts-gen --dt, not by basing it on an existing project.tslint.jsonshould contain{ "extends": "@definitelytyped/dtslint/dt.json" }, and no additional rules.tsconfig.jsonshould havenoImplicitAny,noImplicitThis,strictNullChecks, andstrictFunctionTypesset totrue.If changing an existing definition:
If removing a declaration:
notNeededPackages.json.