Skip to content

createProxyFetch drops Request method, headers, and body #1207

@shaun0927

Description

@shaun0927

Inspector Version

  • 0.21.2-hotfix-3 (also reproducible on current main at adfcccca on 2026-04-14)

Describe the bug
createProxyFetch() handles (url, init) correctly, but when the caller passes a real Request object it only forwards request.url and drops the request semantics. The proxied payload loses the original method, headers, and body.

That makes the wrapper behave differently from normal fetch semantics depending on how the caller constructs the request.

To Reproduce

  1. Configure createProxyFetch() with any valid proxy config.
  2. Call it with a Request object instead of (url, init), for example:
    await fetchFn(
      new Request("https://example.com/token", {
        method: "POST",
        headers: {
          "Content-Type": "application/x-www-form-urlencoded",
          "X-Test": "1",
        },
        body: "grant_type=authorization_code&code=abc",
      }),
    );
  3. Inspect the JSON body sent to POST /fetch.
  4. The serialized payload contains the correct url, but init is empty unless a separate init argument was also passed.

Expected behavior
If createProxyFetch() is given a Request, the forwarded proxy payload should preserve the request semantics:

  • method
  • headers
  • body

Request input should behave equivalently to calling the wrapper with (url, init).

Screenshots
Not applicable.

Environment (please complete the following information):

  • OS: macOS 15.4.1
  • Browser: not browser-specific; reproduced with a targeted local Node 22 harness against the current source

Additional context
The current implementation in client/src/lib/proxyFetch.ts reads input.url for Request inputs but only serializes init?.method, init?.headers, and init?.body. If the caller passes a Request without a second init, those fields are dropped.

I have a minimal fix and regression test prepared locally if this issue sounds aligned with the intended behavior.

Version Consideration
Inspector V2 is under development to address architectural and UX improvements. During this time, V1 contributions should focus on bug fixes and MCP spec compliance. See CONTRIBUTING.md for more details.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions