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.
Summary
Two
http.requestoverload edge cases:1.
options.pathignored when first arg is a URLhttp.request(new URL("https://api.example.com"), { path: "/v1/foo", method: "POST" })—extractUrlreads the URL only (src/core/interceptor.ts:217), method override is honored (line 222), butoptions.pathis silently dropped. Recordedevent.pathbecomes the URL's pathname instead of the actual request path; endpoint categorization hits the wrong rule.2.
opts.hostcontaining:portcollides with separateopts.portsrc/core/interceptor.ts:69-70reconstructs URLs from both, producinghttp://host:port:port/pathwhichnew URL()rejects — caught silently, instrumentation skipped. Low impact (apps usehostname, nothost) but the silent miss is a footgun.Fix
options.pathis set in the second arg, replaceurl.pathnamebefore computing host/path.hostname; parsehostbefore appendingport.Files
src/core/interceptor.tstests/interceptor.test.tsPriority
P2 — real but uncommon patterns.