Skip to content

Commit 22789ea

Browse files
committed
Duh
Signed-off-by: Connor Avery <[email protected]>
1 parent 7224f63 commit 22789ea

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

packages/getMyPrescriptions/src/extractNHSNumber.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,16 @@ export class NHSNumberValidationError extends Error {
1111

1212
export function extractNHSNumberFromHeaders(headers: EventHeaders): string {
1313
if (headers["nhs-login-identity-proofing-level"]) {
14+
// Proxygen spec will include proofing level header, whereas non-proxygen API will not
1415
return validateNHSNumber(headers["nhsd-nhslogin-user"]!)
1516
} else {
1617
return extractNHSNumber(headers["nhsd-nhslogin-user"])
1718
}
1819
}
1920

2021
export function extractNHSNumber(nhsloginUser: string | undefined): string {
22+
// This function is only relevant for non-proxygen API which prepends proofing level
23+
// to the front of the nhs number ie. P9:1234567890
2124
if (nhsloginUser === undefined || nhsloginUser === null) {
2225
throw new NHSNumberValidationError("nhsdloginUser not passed in")
2326
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export type EventHeaders = Record<string, string | undefined>

0 commit comments

Comments
 (0)