Skip to content

Polluted request.payload by adding undefined field #187

@kierandg

Description

@kierandg

When upgrade to Hapi 2.x, Joi validation polluted request.payload and OAuth signature checking in my app failed. It didn't happen in hapi 1.x with Joi 2. I think that validating the request should not pollute request.payload.

var hapi = require('hapi');

exports.demo = {
    handler: function(request) {
        console.log(request.payload)
        // Output { param1: undefined }
    },
    validate: {
        payload: hapi.types.object({
            param1: hapi.types.string().optional()
        }).options({
            allowUnknown: true
        })
    }
};

Metadata

Metadata

Assignees

Labels

bugBug or defect

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions