Skip to content

Commit

Permalink
Fix typing for Express request and response
Browse files Browse the repository at this point in the history
  • Loading branch information
jasny committed Jul 5, 2023
1 parent 673a95b commit ed7ce93
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@
"eslint-plugin-prettier": "^4.2.1",
"mocha": "^10.0.0",
"prettier": "^2.8.7",
"ts-node": "^10.9.1",
"ts-loader": "^9.4.4",
"ts-node": "^10.9.1",
"typescript": "^5.0.3"
}
}
6 changes: 2 additions & 4 deletions src/sign.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,8 @@ export async function sign<T extends RequestLike | ResponseLike>(message: T, opt
message.headers.set('Signature', `${key}=:${sigBase64}:`);
message.headers.set('Signature-Input', `${key}=${signatureInputString}`);
} else {
Object.assign(message.headers, {
Signature: `${key}=:${sigBase64}:`,
'Signature-Input': `${key}=${signatureInputString}`,
});
message.headers['Signature'] = `${key}=:${sigBase64}:`;
message.headers['Signature-Input'] = `${key}=${signatureInputString}`;
}

return message;
Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ interface HeadersMap {
set(name: string, value: string): void;
}

type Headers = Record<string, string> | HeadersMap;
type Headers = Record<string, HeaderValue> | HeadersMap;

export type HeaderValue = { toString(): string } | string | string[] | undefined;

Expand Down

0 comments on commit ed7ce93

Please sign in to comment.