Skip to content

fix(fetch): forward endpoint, isImport, and body unchanged on retry - #18

Open
walm wants to merge 1 commit into
tharropoulos:1.0.0from
walm:fix-retry-request-args
Open

walm wants to merge 1 commit into
tharropoulos:1.0.0from
walm:fix-retry-request-args

Conversation

@walm

@walm walm commented Aug 20, 2026

Copy link
Copy Markdown

Fixes #17.

The retry after a 5xx in makeRequest rebuilt the named arguments and got three of them wrong:

  • endpoint was not passed, so the retried request went to the bare node URL with no path and got a 404.
  • isImport was not passed and reset to false, so a retried import lost its text/plain content type and its JSONL body was JSON.stringified.
  • body was pre-stringified for non-import requests, then stringified again at the fetch call, so the server received a double-encoded string.

This forwards all arguments unchanged. The fetch call already handles the import/non-import body distinction.

Added two regression tests to tests/fetch/request.test.ts in the style of the existing ones. Both fail against the current 1.0.0 branch and pass with the fix:

  • retry after a 5xx keeps the endpoint path and sends an identical body
  • retry of an import keeps the JSONL body and text/plain content type

Ran vitest run tests/fetch/request.test.ts (8 passed), tsc --noEmit, eslint, and prettier --check on the changed files.

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

Retry after a 5xx drops endpoint and isImport and re-stringifies the body, so retries go to POST / and fail with 404

1 participant