hapi
hapi copied to clipboard
Problem with settings global request.payload.multipart to true in Hapi v19
Support plan
- which support plan is this issue covered by? - Community
- is this issue currently blocking your project? No
- is this issue affecting a production system? Yes
Context
- node version: 12.14.1
- module version: Hapi 19.0.4
- environment (e.g. node, browser, native): node
- used with (e.g. hapi application, another framework, standalone, ...): Hapi with official plugins
- any other relevant information:
How can we help?
Hi everyone! I was updating from Hapi 18.3 to 19.0.4 and want to set request.payload.multipart to true globally, for the all routes by default. I added to my server routes.payload.multipart: true.
But id doesn't work. Server returns 415 error when I try to post multipart data. When I set multipart to true in specific route options - it works fine.
this is my server config:
const config = {
host: host,
port: port,
state: {
// Fix for 'Error: Invalid cookie header'!
ignoreErrors: true,
},
routes: {
payload: {
multipart: true,
},
security: {
xframe: {
rule: 'allow-from',
source: '*',
},
},
},
}
Look like this is same my issue at https://github.com/hapijs/hapi/issues/4042
This is due to https://github.com/hapijs/hapi/blob/c3cc6a11598d59f9fa54a204a9322bd5a0f8398f/lib/config.js#L149
@hueniverse shouldn't that strip false values instead?