Skip to content

fix(agent-client): normalize path joining in HttpRequester#1539

Open
Scra3 wants to merge 1 commit intomainfrom
fix/http-requester-path-normalization
Open

fix(agent-client): normalize path joining in HttpRequester#1539
Scra3 wants to merge 1 commit intomainfrom
fix/http-requester-path-normalization

Conversation

@Scra3
Copy link
Copy Markdown
Member

@Scra3 Scra3 commented Apr 10, 2026

Summary

  • When api_endpoint has no trailing slash (e.g. https://example.com/backoffice/v1) and action endpoints have no leading slash (e.g. forest/actions/my-action), HttpRequester produces broken URLs like /backoffice/v1forest/actions/...
  • Extract a buildUrl() method that ensures the path always starts with / before concatenation
  • Applied to both query() and stream() methods

Test plan

  • All 282 agent-client tests pass
  • New test verifies path without leading slash is normalized
  • Verify action execution works with Ruby backend endpoints

🤖 Generated with Claude Code

Note

Normalize path joining in HttpRequester to prevent malformed URLs

Extracts URL construction into a private buildUrl(path) method in http-requester.ts that ensures paths always have a leading / before joining with baseUrl. Both query and stream now use this helper instead of inline concatenation. A test covering paths without a leading slash is added in http-requester.test.ts.

Macroscope summarized 125d71d.

@qltysh
Copy link
Copy Markdown

qltysh bot commented Apr 10, 2026

Qlty

Coverage Impact

This PR will not change total coverage.

Modified Files with Diff Coverage (1)

RatingFile% DiffUncovered Line #s
Coverage rating: A Coverage rating: A
packages/agent-client/src/http-requester.ts100.0%
Total100.0%
🚦 See full report on Qlty Cloud »

🛟 Help
  • Diff Coverage: Coverage for added or modified lines of code (excludes deleted files). Learn more.

  • Total Coverage: Coverage for the whole repository, calculated as the sum of all File Coverage. Learn more.

  • File Coverage: Covered Lines divided by Covered Lines plus Missed Lines. (Excludes non-executable lines including blank lines and comments.)

    • Indirect Changes: Changes to File Coverage for files that were not modified in this PR. Learn more.

When api_endpoint has no trailing slash and action endpoints have no
leading slash, the URL concatenation produces broken paths like
/backoffice/v1forest/actions/... instead of /backoffice/v1/forest/actions/...

Extract a buildUrl() method that ensures the path always starts with /
before concatenation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Scra3 Scra3 force-pushed the fix/http-requester-path-normalization branch from 6d013f9 to 125d71d Compare April 10, 2026 12:23
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.

1 participant