Closed thanh-taro closed 3 years ago
Do you have const httpHeaderNormalizer = require('@middy/http-header-normalizer')
before the middleware?
Here is an end-to-end example:
const middleware = middy(handler)
.use(httpEventNormalizer())
.use(httpHeaderNormalizer())
.use(httpUrlencodePathParametersParser())
.use(httpUrlencodeBodyParser())
.use(httpJsonBodyParser())
.use(httpCors())
.use(httpSecurityHeaders())
.use(
httpContentNegotiation({
availableLanguages: ['en-CA', 'fr-CA'],
availableMediaTypes: ['application/vnd.api+json']
})
)
.use(authorization({ accessRole }))
.use(validator({ inputSchema, outputSchema, ajvOptions }))
.use(httpErrorHandler())
I hope that helps.
Yes. I know. But what if I use httpHeaderNormalizer
with option canonical=true
, which will transform the header into Content-Type
?
I think httpMultipartBodyParser
should accept the header without care about lowercase or uppercase, or at least, it should accept both content-type
and Content-Type
.
Can you put a PR together?
Sure.
@middy/core version 1.0.0-beta3 @middy/middy/http-multipart-body-parser version 1.0.0-beta3
I have a problem with httpMultipartBodyParser. It seems only accept
content-type
in lowercase.This works:
This doesn't work:
and throws Error:
Please, help me to check. Thank you a lot.