Skip to content

Problem with settings global request.payload.multipart to true in Hapi v19 #4027

Closed
@PazzaVlad

Description

@PazzaVlad

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: '*',
			},
		},
	},
}

Activity

added
supportQuestions, discussions, and general support
on Jan 19, 2020
self-assigned this
on Jan 19, 2020
phattranky

phattranky commented on Feb 6, 2020

@phattranky

Look like this is same my issue at #4042

Marsup

Marsup commented on Feb 6, 2020

@Marsup
Contributor

This is due to

.when('.', { is: true, then: Joi.object().strip() }),

@hueniverse shouldn't that strip false values instead?

added
bugBug or defect
and removed
supportQuestions, discussions, and general support
on Feb 13, 2020
added this to the 19.1.1 milestone on Feb 13, 2020
added a commit that references this issue on May 10, 2024
85d7801
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugBug or defect

Type

No type

Projects

No projects

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @hueniverse@Marsup@phattranky@PazzaVlad

      Issue actions

        Problem with settings global request.payload.multipart to true in Hapi v19 · Issue #4027 · hapijs/hapi