feat: Make HeaderHandler customizable.

This commit is contained in:
Ruben Verborgh
2020-11-29 23:35:51 +01:00
parent 023ff80f48
commit d6c0f89cf5
3 changed files with 26 additions and 14 deletions

View File

@@ -7,11 +7,11 @@ import type { HttpResponse } from '../HttpResponse';
export class HeaderHandler extends HttpHandler {
private readonly headers: Record<string, string>;
public constructor() {
// Not supported by Components.js yet
// eslint-disable-next-line @typescript-eslint/consistent-indexed-object-style
public constructor(headers: { [header: string]: string } = {}) {
super();
this.headers = {
'x-powered-by': 'Community Solid Server',
};
this.headers = { ...headers };
}
public async handle({ response }: { response: HttpResponse }): Promise<void> {