fix(angular): url-encode path params when urlEncodeParameters is set - #3541
Conversation
Wire makeRouteSafe into the Angular httpClient and httpResource builders and the angular-query client, mirroring query/fetch. Previously the flag was a no-op for these clients, so path params were interpolated raw. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThis PR adds support for URL-encoding path parameters in Angular client generators ( ChangesURL-encode parameters across Angular generators
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tests/configs/angular.config.ts`:
- Around line 298-302: The Angular override uses the wrong property name: in the
override object under "angular" change the key from client to retrievalClient so
it matches other httpResource configs; locate the override block with angular {
client: 'httpResource' } and replace that property name with retrievalClient:
'httpResource' (ensure the value remains 'httpResource') so the httpResource
retrieval client is properly configured.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 5221c1be-2733-4c08-a7cd-d700d45142c2
📒 Files selected for processing (70)
packages/angular/src/http-client.test.tspackages/angular/src/http-client.tspackages/angular/src/http-resource.test.tspackages/angular/src/http-resource.tspackages/query/src/client.tstests/__snapshots__/angular-query/url-encode-parameters/endpoints.tstests/__snapshots__/angular-query/url-encode-parameters/model/cat.tstests/__snapshots__/angular-query/url-encode-parameters/model/catType.tstests/__snapshots__/angular-query/url-encode-parameters/model/createPetsBody.tstests/__snapshots__/angular-query/url-encode-parameters/model/createPetsParams.tstests/__snapshots__/angular-query/url-encode-parameters/model/createPetsSort.tstests/__snapshots__/angular-query/url-encode-parameters/model/dachshund.tstests/__snapshots__/angular-query/url-encode-parameters/model/dachshundBreed.tstests/__snapshots__/angular-query/url-encode-parameters/model/dog.tstests/__snapshots__/angular-query/url-encode-parameters/model/dogType.tstests/__snapshots__/angular-query/url-encode-parameters/model/error.tstests/__snapshots__/angular-query/url-encode-parameters/model/index.tstests/__snapshots__/angular-query/url-encode-parameters/model/labradoodle.tstests/__snapshots__/angular-query/url-encode-parameters/model/labradoodleBreed.tstests/__snapshots__/angular-query/url-encode-parameters/model/listPetsParams.tstests/__snapshots__/angular-query/url-encode-parameters/model/listPetsSort.tstests/__snapshots__/angular-query/url-encode-parameters/model/pet.tstests/__snapshots__/angular-query/url-encode-parameters/model/petCallingCode.tstests/__snapshots__/angular-query/url-encode-parameters/model/petCountry.tstests/__snapshots__/angular-query/url-encode-parameters/model/petWithTag.tstests/__snapshots__/angular-query/url-encode-parameters/model/pets.tstests/__snapshots__/angular/url-encode-parameters-http-resource/endpoints.tstests/__snapshots__/angular/url-encode-parameters-http-resource/model/cat.tstests/__snapshots__/angular/url-encode-parameters-http-resource/model/catType.tstests/__snapshots__/angular/url-encode-parameters-http-resource/model/createPetsBody.tstests/__snapshots__/angular/url-encode-parameters-http-resource/model/createPetsParams.tstests/__snapshots__/angular/url-encode-parameters-http-resource/model/createPetsSort.tstests/__snapshots__/angular/url-encode-parameters-http-resource/model/dachshund.tstests/__snapshots__/angular/url-encode-parameters-http-resource/model/dachshundBreed.tstests/__snapshots__/angular/url-encode-parameters-http-resource/model/dog.tstests/__snapshots__/angular/url-encode-parameters-http-resource/model/dogType.tstests/__snapshots__/angular/url-encode-parameters-http-resource/model/error.tstests/__snapshots__/angular/url-encode-parameters-http-resource/model/index.tstests/__snapshots__/angular/url-encode-parameters-http-resource/model/labradoodle.tstests/__snapshots__/angular/url-encode-parameters-http-resource/model/labradoodleBreed.tstests/__snapshots__/angular/url-encode-parameters-http-resource/model/listPetsParams.tstests/__snapshots__/angular/url-encode-parameters-http-resource/model/listPetsSort.tstests/__snapshots__/angular/url-encode-parameters-http-resource/model/pet.tstests/__snapshots__/angular/url-encode-parameters-http-resource/model/petCallingCode.tstests/__snapshots__/angular/url-encode-parameters-http-resource/model/petCountry.tstests/__snapshots__/angular/url-encode-parameters-http-resource/model/petWithTag.tstests/__snapshots__/angular/url-encode-parameters-http-resource/model/pets.tstests/__snapshots__/angular/url-encode-parameters/endpoints.tstests/__snapshots__/angular/url-encode-parameters/model/cat.tstests/__snapshots__/angular/url-encode-parameters/model/catType.tstests/__snapshots__/angular/url-encode-parameters/model/createPetsBody.tstests/__snapshots__/angular/url-encode-parameters/model/createPetsParams.tstests/__snapshots__/angular/url-encode-parameters/model/createPetsSort.tstests/__snapshots__/angular/url-encode-parameters/model/dachshund.tstests/__snapshots__/angular/url-encode-parameters/model/dachshundBreed.tstests/__snapshots__/angular/url-encode-parameters/model/dog.tstests/__snapshots__/angular/url-encode-parameters/model/dogType.tstests/__snapshots__/angular/url-encode-parameters/model/error.tstests/__snapshots__/angular/url-encode-parameters/model/index.tstests/__snapshots__/angular/url-encode-parameters/model/labradoodle.tstests/__snapshots__/angular/url-encode-parameters/model/labradoodleBreed.tstests/__snapshots__/angular/url-encode-parameters/model/listPetsParams.tstests/__snapshots__/angular/url-encode-parameters/model/listPetsSort.tstests/__snapshots__/angular/url-encode-parameters/model/pet.tstests/__snapshots__/angular/url-encode-parameters/model/petCallingCode.tstests/__snapshots__/angular/url-encode-parameters/model/petCountry.tstests/__snapshots__/angular/url-encode-parameters/model/petWithTag.tstests/__snapshots__/angular/url-encode-parameters/model/pets.tstests/configs/angular-query.config.tstests/configs/angular.config.ts
`client` is a kept-for-compat alias; `retrievalClient` is the documented preferred name. Output is identical (both normalize to the same value). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
| let route = _route; | ||
| if (context.output.urlEncodeParameters) { | ||
| route = makeRouteSafe(route); | ||
| } |
There was a problem hiding this comment.
I don't think this belongs here as makeRouteSafe is used in /fetch/index.ts and /query/client.ts so moving this to here won't it double encode the routes now in Fetch and Tanstack Query?
There was a problem hiding this comment.
This only affects the angular client (were in generateAngularHttpRequestFunction function).
Other clients are unaffected, and the generated code for them is identical with or without this change.
|
@soartec-lab do you remember why this is moved inside each client instead of at a higher level like it is in this PR? @wadakatu any thoughts here |
|
Ahhh I see now @cghislai thanks! |
|
@melloware |
Wire makeRouteSafe into the Angular httpClient and httpResource builders and the angular-query client, mirroring query/fetch. Previously the flag was a no-op for these clients, so path params were interpolated raw.
Fixes #3540
Summary by CodeRabbit
New Features
Tests
Chores