Revert "style(proxy): format docker protocol tests"

This reverts commit 213e04de76.
This commit is contained in:
xixu-me committed 2026-03-09 16:56:27 +08:00
1 parent a72f9142ab
commit 8075a181de
2 files changed
+8 -5

No files matched your search

+5 -4
View File
@@ -130,9 +130,7 @@ function normalizeRepoPath(platformKey, repoPath) {
* @returns {string} Repository path without the `/v2/` prefix or operation suffix.
*/
function extractRepositoryPath(apiPath) {
const normalizedPath = apiPath.startsWith('/v2/')
? apiPath.slice(4)
: apiPath.replace(/^\/+/, '');
const normalizedPath = apiPath.startsWith('/v2/') ? apiPath.slice(4) : apiPath.replace(/^\/+/, '');
const pathParts = normalizedPath.split('/').filter(Boolean);
if (pathParts.length === 0 || pathParts[0].startsWith('_')) {
@@ -230,7 +228,10 @@ export function responseUnauthorized(url, platform) {
const realmPath = platform ? `/cr/${platform.slice(3)}/v2/auth` : '/v2/auth';
const headers = new Headers();
headers.set('Content-Type', 'application/json');
headers.set('WWW-Authenticate', `Bearer realm="${url.origin}${realmPath}",service="Xget"`);
headers.set(
'WWW-Authenticate',
`Bearer realm="${url.origin}${realmPath}",service="Xget"`
);
return new Response(
JSON.stringify({
errors: [
+3 -1
View File
@@ -198,7 +198,9 @@ describe('Docker Authentication', () => {
const response = await worker.fetch(request, {}, executionContext);
expect(response.status).toBe(200);
expect(String(fetchSpy.mock.calls[1][0])).toContain('scope=repository%3Aprivate%2Frepo%3Apull');
expect(String(fetchSpy.mock.calls[1][0])).toContain(
'scope=repository%3Aprivate%2Frepo%3Apull'
);
});
});