Skip to content

bug(Conformance): a client that rewrites the request URL (mapRequest) is read as a transport-followed redirect #359

Closed

Description

@thomasfosterau

A regression from #355, found in its post-merge review.

Problem

#355 treats a request the transport ended somewhere other than where the kit sent it as "a redirect the transport followed itself". The check compares the final request against the kit's own sent request, in src/internal/conformance/core.ts ~L771-786. That also catches a client that rewrites the URL with no redirect anywhere, e.g. HttpClient.mapRequest(client, (r) => HttpClientRequest.setUrl(r, …)) mapping baseUrl: "http://api.invalid" to a local port.

Fix

Compare the final request against client.preprocess(request), i.e. the request after any mapRequest, rather than against the kit's sent. In effect 4.0.0, mapRequest composes into preprocess, while followRedirects runs in postprocess, so this separates rewriting from following.

Add a test with a mapRequest that rewrites the origin. List origin-rewriting clients among the documented cases in docs/conformance.md §1.2.

Done when

  • A URL-rewriting client is read normally, with no skip and no reachable finding.
  • A redirect-following client still skips.

Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions