Open frankthelen opened 4 years ago
Seems like Hapi v19 broke some things. Tests are failing on Node 10 due to new syntax. Tbh I haven't used Hapi for a long time. If you can submit a PR with a test for your case, that'd be awesome.
Looking briefly at your code, I think, this is the problem:
response._setSource(newSource, "plain")
https://github.com/seangenabe/etagger/blob/master/index.ts#L53
You should not set the response payload to its stringified version.
We are just upgrading our system from Hapi 18 / Joi 15 to Hapi 19 / Joi 16. What we see is a very strange behavior in conjunction with etagger (5.0.3).
If etagger is plugged-in and enabled, it will cause Hapi to stringify all response payloads before passing them to Joi. This breaks all response validation except
Joi.any()
orJoi.string()
. In our case, pretty much all GET routes, e.g.,Joi.array()
results in HTTP 500 andValidationError: \"foo\" must be an array
.If etagger is out, everything is fine like before upgrading.