dwyl / hapi-auth-jwt2

:lock: Secure Hapi.js authentication plugin using JSON Web Tokens (JWT) in Headers, URL or Cookies
ISC License
798 stars 126 forks source link

Issue #468 handle error object passed into raise error #469

Closed virginiam1203 closed 3 months ago

virginiam1203 commented 3 months ago

Code to address bug in Issue #468 https://github.com/dwyl/hapi-auth-jwt2/issues/468

Added a check for an error object passed into the method with "boomify" and handle it accordingly so boom will not throw an "Unable to wrap non-error object" error.

Tidied up the validate_func tests to match other test files with a separate server setup. This allowed for better debugging in my experience.

Separated out tests into specific cases.

Techncially the 'ASPLODE' test was also impacted by this bug, but the test did not catch it because the Hapi server wraps any 500 error in a generic "Internal Server Error" message, so I added a new case that throws a 404 error and is broken without the bug fix.

nelsonic commented 3 months ago

@virginiam1203 your code is included in hapi-auth-jwt2@10.6.0 📦 🚀