-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
correctly serialize headers and timeout
- Loading branch information
1 parent
11b89b2
commit 9d32ff2
Showing
5 changed files
with
52 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@penumbra-zone/transport-dom': patch | ||
--- | ||
|
||
convey timeout in request headers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@penumbra-zone/transport-dom': patch | ||
--- | ||
|
||
exclude non-transferable type member from internal message types |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/** | ||
* Collect timeout and user-provided headers to a JSON-serializable object. | ||
*/ | ||
export const normalizeHeader = (timeoutMs?: number, userProvidedHeaders?: HeadersInit) => { | ||
const headers = new Headers(userProvidedHeaders ?? {}); | ||
|
||
if (timeoutMs) { | ||
headers.set('headerTimeout', `${timeoutMs}`); | ||
} | ||
|
||
const entries = Array.from(headers); | ||
|
||
return entries.length ? Object.fromEntries(entries) : undefined; | ||
}; |