Skip to content
This repository was archived by the owner on Dec 18, 2024. It is now read-only.

Commit 3aa2b60

Browse files
fix(postal-code-lookup): return null if length is != 4
1 parent 5b64441 commit 3aa2b60

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/collections/delivery/operations/postal-code-lookup.operation.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ export class PostalCodeLookupOperation implements Operation {
4444
if (!verifyPostalCodeLookupSpec(postalCodeLookupSpec)) {
4545
throw new BlError(`Malformed PostalCodeSpec`).code(701);
4646
}
47+
if (postalCodeLookupSpec.postalCode.length !== 4) {
48+
return new BlapiResponse([{ postalCity: null }]);
49+
}
4750
const bringAuthHeaders = {
4851
"X-MyBring-API-Key": process.env["BRING_API_KEY"],
4952
"X-MyBring-API-Uid": process.env["BRING_API_ID"],

0 commit comments

Comments
 (0)