Skip to content

feat: add configurable auth and API endpoints#275

Merged
kamaz merged 1 commit intomainfrom
feat/configurable-endpoints
Jan 8, 2026
Merged

feat: add configurable auth and API endpoints#275
kamaz merged 1 commit intomainfrom
feat/configurable-endpoints

Conversation

@kamaz
Copy link
Contributor

@kamaz kamaz commented Jan 8, 2026

Add optional authUrl and apiUrl configuration options to CommercetoolsBaseConfig
to allow custom endpoint URLs. This enables pointing to mock servers for
integration testing while maintaining full backward compatibility.

Changes:

  • Add authUrl and apiUrl optional properties to CommercetoolsBaseConfig
  • Update CommercetoolsAuthApi to use custom endpoints when provided
  • Update CommercetoolsApi to use custom endpoints when provided
  • Both classes fall back to region-based URLs when custom URLs not specified
  • Add comprehensive test coverage for custom endpoint functionality
  • Add integration tests verifying requests use custom endpoints correctly

All existing tests pass, confirming full backward compatibility.
No breaking changes - custom endpoints are optional and default behavior
is preserved when not specified.

Add optional authUrl and apiUrl configuration options to CommercetoolsBaseConfig
to allow custom endpoint URLs. This enables pointing to mock servers for
integration testing while maintaining full backward compatibility.

Changes:
- Add authUrl and apiUrl optional properties to CommercetoolsBaseConfig
- Update CommercetoolsAuthApi to use custom endpoints when provided
- Update CommercetoolsApi to use custom endpoints when provided
- Both classes fall back to region-based URLs when custom URLs not specified
- Add comprehensive test coverage for custom endpoint functionality
- Add integration tests verifying requests use custom endpoints correctly

All existing tests pass, confirming full backward compatibility.
No breaking changes - custom endpoints are optional and default behavior
is preserved when not specified.
@github-actions
Copy link

github-actions bot commented Jan 8, 2026

Coverage Report

Totals Coverage
Statements: 99.84% ( 80510 / 80639 )
Methods: 95.16% ( 236 / 248 )

@kamaz kamaz merged commit e1fbccf into main Jan 8, 2026
7 checks passed
Copy link

Copilot AI left a 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 adds support for configurable authentication and API endpoints to enable integration testing with mock servers. The changes introduce optional authUrl and apiUrl configuration properties that override the default region-based endpoint URLs when provided.

Key changes:

  • Added optional authUrl and apiUrl properties to CommercetoolsBaseConfig interface with clear documentation
  • Updated CommercetoolsAuthApi and CommercetoolsApi classes to use custom endpoints when provided, falling back to region-based URLs otherwise
  • Added comprehensive test coverage validating both endpoint configuration and actual request behavior with custom endpoints

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/lib/types.ts Added optional authUrl and apiUrl properties to CommercetoolsBaseConfig with JSDoc documentation and examples
src/lib/auth/CommercetoolsAuthApi.ts Updated constructor to use custom endpoints when provided via config, with fallback to region-based URLs
src/lib/api/CommercetoolsApi.ts Updated constructor to use custom endpoints when provided via config, with fallback to region-based URLs
src/test/auth/CommercetoolsAuthApi.test.ts Added constructor tests and integration test verifying custom auth endpoint usage in actual requests
src/test/auth/CommercetoolsAuth.test.ts Added configuration tests verifying custom endpoints are properly passed through and integration test with custom endpoint
src/test/api/CommercetoolsApi.test.ts Added constructor tests covering all endpoint configuration combinations and integration test verifying custom endpoints in requests

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@kamaz kamaz deleted the feat/configurable-endpoints branch January 8, 2026 09:58
@github-actions
Copy link

github-actions bot commented Jan 8, 2026

🎉 This PR is included in version 6.16.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments