Open hezhengxu2018 opened 1 month ago
The changes in the ProxyCacheService
, ProxyCacheController
, and ShowPackageController
classes involve enhancements to error handling, method visibility, and the organization of logic related to manifest retrieval and cache management. The getRewrittenManifest
method has been made private, while a new method, replaceTarballUrl
, has been introduced. The controller now utilizes a CacheService
, simplifying method signatures and altering error handling. Test cases have been updated to reflect these changes, including the removal of tests for certain methods and adjustments to expected outcomes for DELETE operations.
File Path | Change Summary |
---|---|
app/core/service/ProxyCacheService.ts | - Updated getPackageManifest and getPackageVersionManifest with error handling.- Made getRewrittenManifest private and introduced replaceTarballUrl method.- Updated getProxyResponse to use ctx.headers . |
app/port/controller/ProxyCacheController.ts | - Updated imports and switched to CacheService .- Modified refreshProxyCaches and removeProxyCaches methods for cache handling.- Changed truncateProxyCaches to throw NotImplementedError . |
app/port/controller/package/ShowPackageController.ts | - Updated show method for cache handling and response construction, including error handling improvements. |
test/core/service/ProxyCacheService.test.ts | - Removed getRewrittenManifest() tests and updated executeTask() test to focus on getPackageVersionManifest . |
test/port/controller/ProxyCacheController/index.test.ts | - Removed tests for unauthorized DELETE access and updated expected responses for DELETE operations. |
ProxyCacheService
regarding error handling and method visibility are related to the comprehensive caching mechanism and methods for obtaining package manifests and versions introduced in this PR, which also modifies the ProxyCacheService
.DownloadPackageVersionTarController
to handle package downloads align with the changes in ProxyCacheService
, particularly in how manifests and tarball URLs are managed and retrieved, ensuring compatibility with different path styles.enhancement
In the service where proxies play,
Headers shift in a clever way.
Errors now sing with a clearer tone,
Logging tasks, no longer alone.
With types well-handled, all in line,
Cache updates flow, oh how they shine! 🐇✨
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 96.47%. Comparing base (
d6f0e1d
) to head (3f5d7ba
). Report is 7 commits behind head on master.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Hey @hezhengxu2018, here are examples of how you can ask me to improve this pull request:
@sweep Fix the CI errors.
@sweep Add unit tests for the new `replaceTarballUrl` method in ProxyCacheService to verify it correctly replaces registry URLs in both package manifests and version manifests.
:book: For more information on how to use Sweep, please read our documentation.
proxy时因为一个低级的拼写错误没有正确的携带请求头,导致代理模式时返回的数据不正确。但是现在用户发起的请求中的user-agent和x-forwarded等头部信息也没有正确的携带。虽然影响不大但还是想和跑批时更新的请求做一下区分。
Summary by CodeRabbit
Bug Fixes
Improvements