fix(core,testing): improve type safety and update tests for latest tstest and storage APIs
This commit is contained in:
@@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@push.rocks/smartregistry',
|
||||
version: '2.9.1',
|
||||
version: '2.9.2',
|
||||
description: 'A composable TypeScript library implementing OCI, NPM, Maven, Cargo, Composer, PyPI, and RubyGems registries for building unified container and package registries'
|
||||
}
|
||||
|
||||
@@ -6,7 +6,12 @@ import type { IRequestContext, IResponse, IAuthToken, IRequestActor } from './in
|
||||
*/
|
||||
export abstract class BaseRegistry {
|
||||
protected getHeader(contextOrHeaders: IRequestContext | Record<string, string>, name: string): string | undefined {
|
||||
const headers = 'headers' in contextOrHeaders ? contextOrHeaders.headers : contextOrHeaders;
|
||||
const headers: Record<string, string> =
|
||||
'headers' in contextOrHeaders &&
|
||||
typeof contextOrHeaders.headers === 'object' &&
|
||||
contextOrHeaders.headers !== null
|
||||
? contextOrHeaders.headers
|
||||
: contextOrHeaders as Record<string, string>;
|
||||
if (headers[name] !== undefined) {
|
||||
return headers[name];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user