feat(core,storage,oci,registry-config): add streaming response support and configurable registry URLs across protocols
This commit is contained in:
@@ -89,16 +89,10 @@ async function createHttpServer(
|
||||
res.setHeader(key, value);
|
||||
}
|
||||
|
||||
// Send body
|
||||
// Send body (response.body is always ReadableStream<Uint8Array> or undefined)
|
||||
if (response.body) {
|
||||
if (Buffer.isBuffer(response.body)) {
|
||||
res.end(response.body);
|
||||
} else if (typeof response.body === 'string') {
|
||||
res.end(response.body);
|
||||
} else {
|
||||
res.setHeader('Content-Type', 'application/json');
|
||||
res.end(JSON.stringify(response.body));
|
||||
}
|
||||
const { Readable } = await import('stream');
|
||||
Readable.fromWeb(response.body).pipe(res);
|
||||
} else {
|
||||
res.end();
|
||||
}
|
||||
@@ -303,16 +297,16 @@ tap.test('PyPI CLI: should verify twine is installed', async () => {
|
||||
});
|
||||
|
||||
tap.test('PyPI CLI: should setup registry and HTTP server', async () => {
|
||||
// Create registry
|
||||
registry = await createTestRegistry();
|
||||
// Use port 39000 (avoids conflicts with other tests)
|
||||
registryPort = 39000;
|
||||
|
||||
// Create registry with correct registryUrl for CLI tests
|
||||
registry = await createTestRegistry({ registryUrl: `http://localhost:${registryPort}` });
|
||||
const tokens = await createTestTokens(registry);
|
||||
pypiToken = tokens.pypiToken;
|
||||
|
||||
expect(registry).toBeInstanceOf(SmartRegistry);
|
||||
expect(pypiToken).toBeTypeOf('string');
|
||||
|
||||
// Use port 39000 (avoids conflicts with other tests)
|
||||
registryPort = 39000;
|
||||
const serverSetup = await createHttpServer(registry, registryPort);
|
||||
server = serverSetup.server;
|
||||
registryUrl = serverSetup.url;
|
||||
|
||||
Reference in New Issue
Block a user