When an HTTP request that has "Content-type: plain/text" and no payload is received by hapi,
When an HTTP request w/o content-type an no payload is parsed by hapi,
The text was updated successfully, but these errors were encountered:
(space in body) results in
(empty body) results in
How does this makes sence ? Detecting an empty string requires to do:
if (typeof request.payload === 'object' && Object.keys(request.payload) === 0 && (request.headers['content-type'] || '').split(';') === 'text/plain')
if (request.payload === '')
In the case of a route that only expects plain/text payload, the first example does not make much sence.
Plain text requests with empty bodies should also have a falsey payload in my opinion.
I'm sorry for the poor communication– I meant that your gripe makes sense. I agree that a
In the case of an empty content-type header and an empty body, I am less sure. Here's what the spec says: