Skip to content

Comments

fix(http): treat http://localhost as base URL for relative paths to a…#4

Open
MitchLewis930 wants to merge 1 commit intopr_024_beforefrom
pr_024_after
Open

fix(http): treat http://localhost as base URL for relative paths to a…#4
MitchLewis930 wants to merge 1 commit intopr_024_beforefrom
pr_024_after

Conversation

@MitchLewis930
Copy link

PR_024

@MitchLewis930 MitchLewis930 requested a review from Copilot January 31, 2026 00:52
Copy link

Copilot AI left a comment

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 fixes an issue in the HTTP adapter where relative URLs were not being properly handled. The change treats http://localhost as a base URL when parsing URLs, allowing relative paths to be resolved correctly.

Changes:

  • Modified URL parsing in the HTTP adapter to support relative URLs by providing a default base URL

// Parse url
const fullPath = buildFullPath(config.baseURL, config.url);
const parsed = new URL(fullPath);
const parsed = new URL(fullPath, 'http://localhost');
Copy link

Copilot AI Jan 31, 2026

Choose a reason for hiding this comment

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

Using 'http://localhost' as a base URL could cause issues when fullPath is already an absolute URL with a different protocol (e.g., 'https://example.com'). The URL constructor will incorrectly parse absolute URLs when given a base. Consider checking if fullPath is absolute before providing a base URL, or handle the case where the parsed URL doesn't match the intended target.

Copilot uses AI. Check for mistakes.
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.

2 participants