-
Notifications
You must be signed in to change notification settings - Fork 481
refactor: replace CoreWebService with HttpClient in various services #34165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
### Summary This commit refactors multiple services to replace the deprecated CoreWebService with Angular's HttpClient for making HTTP requests. The changes enhance code clarity and maintainability by utilizing Angular's built-in HTTP capabilities. ### Changes Made - Updated services to use HttpClient for GET, POST, PUT, and DELETE requests. - Replaced operator with for extracting response data. - Ensured all services maintain their original functionality while improving type safety and reducing boilerplate code. ### Impact This refactor improves the overall architecture by promoting the use of Angular's HttpClient, aligning with best practices for modern Angular development. ### Testing All affected services have been tested to ensure that they function correctly with the new implementation. ### Checklist - [x] Code compiles without errors - [x] Documentation updated - [x] Linting & formatting applied - [x] Ready for review
…ice and DotTemplatesService
…or improved clarity and maintainability
…with provideHttpClient and provideHttpClientTesting for improved clarity and maintainability
There was a problem hiding this 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 pull request refactors multiple Angular services to replace the deprecated CoreWebService with Angular's native HttpClient. The migration involves approximately 40+ service files and their corresponding test files, updating URL formats, replacing the deprecated pluck operator with map, and modernizing test patterns.
Key Changes:
- Migrated from
CoreWebServiceto Angular'sHttpClientfor HTTP requests - Normalized API URLs to include
/api/prefix (e.g.,v1/users→/api/v1/users) - Replaced
pluckoperator withmapfor response data extraction - Updated test files to use
provideHttpClient()andprovideHttpClientTesting()instead of deprecatedHttpClientTestingModule - Added comprehensive migration documentation
Reviewed changes
Copilot reviewed 73 out of 73 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
dot-request-response.model.ts |
Added new DotCMSResponseJsonObject interface for bodyJsonObject responses |
core-web-service-migration.md |
Added comprehensive migration guide with patterns and examples (610 lines) |
core-web.service.ts |
Marked DotCMSResponse as deprecated |
site.service.ts |
Migrated to HttpClient, corrected URLs, replaced pluck with map |
login.service.ts |
Migrated to HttpClient, fixed error property access, improved type safety |
dotcms-config.service.ts |
Migrated to HttpClient with proper response typing |
dot-*.service.ts (30+ files) |
Consistent migration pattern across data-access services |
*.spec.ts (40+ files) |
Modernized tests with provideHttpClient and corrected URL expectations |
Summary
This commit refactors multiple services to replace the deprecated CoreWebService with Angular's HttpClient for making HTTP requests. The changes enhance code clarity and maintainability by utilizing Angular's built-in HTTP capabilities.
Changes Made
Impact
This refactor improves the overall architecture by promoting the use of Angular's HttpClient, aligning with best practices for modern Angular development.
Testing
All affected services have been tested to ensure that they function correctly with the new implementation.
Checklist