Skip to content

[FSSDK-12865] url parse fix#1161

Merged
junaed-optimizely merged 4 commits into
masterfrom
junaed/fssdk-12865-url-parse-alt
Jul 7, 2026
Merged

[FSSDK-12865] url parse fix#1161
junaed-optimizely merged 4 commits into
masterfrom
junaed/fssdk-12865-url-parse-alt

Conversation

@junaed-optimizely

Copy link
Copy Markdown
Contributor

Summary

  • Replace deprecated url.parse() with the WHATWG URL
  • Wrap new URL() in try/catch to gracefully handle invalid URLs (unlike url.parse(), the URL constructor throws on malformed input)

Test plan

Existing tests should pass

Issues

  • FSSDK-12865

@coveralls

coveralls commented Jul 6, 2026

Copy link
Copy Markdown

Coverage Status

coverage: 77.701% (-0.02%) from 77.724% — junaed/fssdk-12865-url-parse-alt into master

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Node.js HTTP request handler to stop using the deprecated legacy url.parse() API and instead parse request URLs using the WHATWG URL constructor, adding error handling for malformed URLs.

Changes:

  • Replaced legacy URL parsing (url.parse) with new URL(requestUrl) in the Node request handler.
  • Added a try/catch around URL construction to gracefully reject malformed URLs.
  • Updated request option construction to work with WHATWG URL fields (pathname/search).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/utils/http_request_handler/request_handler.node.ts
Comment thread lib/utils/http_request_handler/request_handler.node.ts
Comment thread lib/utils/http_request_handler/request_handler.node.ts

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

Comment on lines 91 to 94
hostname: url.hostname,
path: url.path,
port: url.port,
path: url.pathname + url.search,
port: url.port || null,
protocol: url.protocol,
Comment thread lib/utils/http_request_handler/request_handler.node.spec.ts

@raju-opti raju-opti left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approving with one comment

Comment thread lib/utils/http_request_handler/request_handler.node.spec.ts
@junaed-optimizely junaed-optimizely merged commit 9884d73 into master Jul 7, 2026
16 of 25 checks passed
@junaed-optimizely junaed-optimizely deleted the junaed/fssdk-12865-url-parse-alt branch July 7, 2026 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants