Revert "style(proxy): format docker protocol tests"
This reverts commit 213e04de76.
This commit is contained in:
1 parent
fe17b9a1d6
commit
9a666f37a0
2 files changed
+8
-5
No files matched your search
@@ -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: [
|
||||
|
||||
@@ -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'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user