Skip to content

[13.x] Don't expand URL templates without URL parameters - #61893

Merged
taylorotwell merged 1 commit into
laravel:13.xfrom
xurshudyan:http-client-url-braces-without-parameters
Oct 6, 2026
Merged

taylorotwell merged 1 commit into
laravel:13.xfrom
xurshudyan:http-client-url-braces-without-parameters

Conversation

@xurshudyan

Copy link
Copy Markdown
Contributor

Every URL containing { goes through UriTemplate::expand(), even when withUrlParameters() was never called. Anything in braces is treated as a template variable and removed:

Http::get('https://api.test/posts?where={"status":"open"}');
// sends ?where=

The API gets an empty filter and no error is thrown. Plain Guzzle sends the same URL with the braces encoded.

When URL parameters were added in #45982, it was said that nothing changes if you're not using them. This makes that true by only expanding when parameters are set.

@shaedrich

Copy link
Copy Markdown
Contributor

Does this still work?

Http::withUrlParameters([
    'endpoint' => 'https://laravel.com',
    'page' => 'docs',
    'version' => '9.x',
    'thing' => 'validation',
])->get('{+endpoint}/{page}/{version}/{thing}?where={"status":"open"}');

@xurshudyan

Copy link
Copy Markdown
Contributor Author

@shaedrich yes

@taylorotwell
taylorotwell merged commit d302e39 into laravel:13.x Oct 6, 2026
64 checks passed
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.

3 participants