Conversation
The retry call after a 5xx rebuilt the request arguments and dropped endpoint and isImport while pre-stringifying the body. Retried requests went to the bare node URL with no path and got a 404, and non-import bodies were double-encoded. Fixes tharropoulos#17
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #17.
The retry after a 5xx in
makeRequestrebuilt the named arguments and got three of them wrong:endpointwas not passed, so the retried request went to the bare node URL with no path and got a 404.isImportwas not passed and reset to false, so a retried import lost itstext/plaincontent type and its JSONL body was JSON.stringified.bodywas pre-stringified for non-import requests, then stringified again at thefetchcall, so the server received a double-encoded string.This forwards all arguments unchanged. The
fetchcall already handles the import/non-import body distinction.Added two regression tests to
tests/fetch/request.test.tsin the style of the existing ones. Both fail against the current1.0.0branch and pass with the fix:text/plaincontent typeRan
vitest run tests/fetch/request.test.ts(8 passed),tsc --noEmit,eslint, andprettier --checkon the changed files.