-
Notifications
You must be signed in to change notification settings - Fork 97
Conversation
message += `on ${environment} ` | ||
} | ||
message += 'could not be found.' | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This felt complicated for no real reason, so I just cut it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely a little much for the error message.
@@ -57,6 +57,10 @@ export function getPreferredAddressHeaderPair( | |||
preferredAddresses: readonly AddressInformation[] | |||
} | |||
| undefined { | |||
if (allAddresses.length === 0) { | |||
return undefined | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was the bug. By not returning undefined
when we had no addresses, we would fail our if(x === undefined)
check in the middleware, and not 404 correctly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, nice catch.
@@ -147,8 +147,7 @@ describe('E2E - publicAPIRouter - Base PayID', function (): void { | |||
const expectedErrorResponse = { | |||
statusCode: 404, | |||
error: 'Not Found', | |||
message: | |||
'Payment information for johndoe$127.0.0.1 in XRPL on TESTNET could not be found.', | |||
message: 'Payment information for johndoe$127.0.0.1 could not be found.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update random test messages because I changed the 404 not found message.
// THEN we get back a 404 with the expected error response. | ||
.expect(HttpStatus.NotFound, expectedErrorResponse, done) | ||
// }) | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the test that verifies we no longer have a bug in our header processing logic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, I'm happy we fixed this. LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, good find
High Level Overview of Change
Fix bug in header processing logic, and remove needlessly complex logic for the "Not Found" message we provide.
Context of Change
There was a bug in our header processing logic, which, if you requested
payid+json
to a non-existent PayID would respond with a200 - OK
, claiming that PayID existed with no addresses, rather than responding with a404 - Not Found
.Relevant issue: #595
Type of Change
Test Plan
Added a test for the
payid+json
to a nonexistent PayID case, and it now passes (would fail onmaster
).