fix(core,testing): improve type safety and update tests for latest tstest and storage APIs
This commit is contained in:
@@ -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