| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
There was a problem hiding this comment.
This pull request refactors src/utils/api-request.ts to replace the deprecated Node.js url module with the native URL API. Key changes include updating the buildUrl method to return a URL instance and modifying property accesses to use pathname and search instead of the non-existent path property. I have no feedback to provide.
Sorry, something went wrong.
url.parse() is deprecated (DEP0169) and emits warnings on every cold start in serverless runtimes. Migrate the two call sites in BaseRequestConfigImpl.buildUrl() to the WHATWG URL constructor, matching the pattern from firebase#3061. The protected buildUrl() return type changes from url.UrlWithStringQuery to URL. Both call sites are inside the same file. parsed.path is replaced with ${parsed.pathname}${parsed.search} so the request path on the wire stays byte-for-byte identical, and parsed.port is now string (always); the existing if (!port) falsy check still catches the empty case. Fixes firebase#3118.
There was a problem hiding this comment.
Thank you for your contribution! LGTM!
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Closes #3118.
url.parse() is deprecated (DEP0169) and emits warnings on every cold start in serverless runtimes. This swaps the two call sites in BaseRequestConfigImpl.buildUrl() for the WHATWG URL constructor, matching the pattern @lahirumaramba used for validator.isURL() in #3061.
Changes
Behavior
For valid inputs the request URL is byte-for-byte identical. For malformed inputs the WHATWG parser is stricter than url.parse(): depending on the input shape it may either canonicalize the input differently (urlWithProtocol() always prepends https://, so e.g. //evil.com becomes https://evil.com/) or throw a TypeError. SDK-internal callers normalize their URLs before invoking, so well-formed usage is unaffected.
Out of scope
The transitive callers listed in #3118 (http-proxy-agent, teeny-request/agent-base, faye-websocket, @firebase/database-compat) live in separate repositories and need to be addressed there.
Verification
No spec changes: existing api-request tests already cover explicit non-default ports (mockHost:8080), POST with entity body, GET path matching, and nock interceptor URL parsing — all of which exercise the changed code paths.