Skip to content

http.request overload edges: options.path dropped, opts.host with port double-appended #10

Description

@AndresL230

Summary

Two http.request overload edge cases:

1. options.path ignored when first arg is a URL

http.request(new URL("https://api.example.com"), { path: "/v1/foo", method: "POST" })extractUrl reads the URL only (src/core/interceptor.ts:217), method override is honored (line 222), but options.path is silently dropped. Recorded event.path becomes the URL's pathname instead of the actual request path; endpoint categorization hits the wrong rule.

2. opts.host containing :port collides with separate opts.port

src/core/interceptor.ts:69-70 reconstructs URLs from both, producing http://host:port:port/path which new URL() rejects — caught silently, instrumentation skipped. Low impact (apps use hostname, not host) but the silent miss is a footgun.

Fix

  • If options.path is set in the second arg, replace url.pathname before computing host/path.
  • Prefer hostname; parse host before appending port.

Files

  • src/core/interceptor.ts
  • tests/interceptor.test.ts

Priority

P2 — real but uncommon patterns.

Activity

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

    P2Polish / nice-to-havebugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions