Skip to content

Commit

Permalink
Switch back to Node's url.parse for cleaner handling of partial URLs.
Browse files Browse the repository at this point in the history
  • Loading branch information
robhogan committed Oct 17, 2023
1 parent 99306bc commit d24916d
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions packages/dev-middleware/src/inspector-proxy/InspectorProxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,7 @@ export default class InspectorProxy implements InspectorProxyQueries {
response: ServerResponse,
next: (?Error) => mixed,
) {
// When request.url is a relative path, the WHATWG URL constructor will require
// the second "base" param otherwise an exception will be thrown.
// We could use `http://${request.headers.host}` here instead however:
// - We are forced to make an assumption about the scheme so if someone is running
// Metro over https it could cause confusion.
//
// - We are only extracting pathname from the parsed URL so the host portion is
// irrelevant.
const pathname = new URL(request.url, 'http://example').pathname;
const pathname = url.parse(request.url).pathname;
if (
pathname === PAGES_LIST_JSON_URL ||
pathname === PAGES_LIST_JSON_URL_2
Expand Down

0 comments on commit d24916d

Please sign in to comment.