Conversation
The web CapacitorHttp request joined params with '?' even when the url already had a query string, producing url?a=1?b=2. Use '&' in that case, matching Android and iOS. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The web implementation of
CapacitorHttp.request()always joinsparamswith?:When
urlalready has a query string, the request goes to a URL with two?:The Android (
HttpRequestHandler.java) and iOS (HttpRequestHandler.swift) implementations keep the existing query and add the params to it, so the same call behaves differently on web. This PR uses&when the URL already contains?.Change Type
Rationale / Problems Fixed
Any web call that combines a URL with a query string (for example a signed URL or a paging link returned by an API) and
paramssends a wrong request: the first existing parameter gets the rest of the query appended to its value, and the added params are lost.Tests or Reproductions
Added
core/src/tests/http.spec.ts, which mocksfetchand checks the URL passed to it:appends params to a url without a query string: passes before and after.keeps the existing query string when adding params: fails before the fix (https://example.com/api?a=1?b=2), passes after (https://example.com/api?a=1&b=2).npm testincore: all suites pass.eslintandprettier --checkare clean on the changed files.Screenshots / Media
N/A
Platforms Affected
Notes / Comments
This does not touch the array
&&issue inbuildUrlParams(#8270 / #8272); the two changes are independent.I found this while reading the code with an AI assistant (Claude); I checked the failing test and the fix myself.
🤖 Generated with Claude Code