Skip to content

Commit d24916d

Browse files
authored
Switch back to Node's url.parse for cleaner handling of partial URLs.
1 parent 99306bc commit d24916d

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

packages/dev-middleware/src/inspector-proxy/InspectorProxy.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,7 @@ export default class InspectorProxy implements InspectorProxyQueries {
9494
response: ServerResponse,
9595
next: (?Error) => mixed,
9696
) {
97-
// When request.url is a relative path, the WHATWG URL constructor will require
98-
// the second "base" param otherwise an exception will be thrown.
99-
// We could use `http://${request.headers.host}` here instead however:
100-
// - We are forced to make an assumption about the scheme so if someone is running
101-
// Metro over https it could cause confusion.
102-
//
103-
// - We are only extracting pathname from the parsed URL so the host portion is
104-
// irrelevant.
105-
const pathname = new URL(request.url, 'http://example').pathname;
97+
const pathname = url.parse(request.url).pathname;
10698
if (
10799
pathname === PAGES_LIST_JSON_URL ||
108100
pathname === PAGES_LIST_JSON_URL_2

0 commit comments

Comments
 (0)