Repository navigation
fix(index): preserve global option fields when route options are partial - #398
ranjeetcao wants to merge 1 commit into
Conversation
Calling `Object.assign({}, global, processCompressParams(partialRoute))`
copies undefined values from the post-processed route object onto the
global params, silently nulling out fields like `onInvalidRequestPayload`,
`onUnsupportedRequestEncoding`, and `onUnsupportedEncoding` whenever
the route configures only one of them.
Fix the merge order: combine the raw user opts with the raw route opts
first, then pass the result through `processCompressParams` /
`processDecompressParams` once so each derived field is computed from a
coherent input rather than shallow-merged from already-processed objects.
Adds unit tests covering both decompress hook fallbacks and the
compress `onUnsupportedEncoding` fallback.
Closes fastify#340
|
Closing as a duplicate of #397 (opened May 11, 6 days before mine — I missed it when scanning the issue). Apologies for the noise. |
|
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Calling
Object.assign({}, global, processCompressParams(partialRoute))copies undefined values from the post-processed route object onto the global params, silently nulling out fields likeonInvalidRequestPayload,onUnsupportedRequestEncoding, andonUnsupportedEncodingwhenever the route configures only one of them.Fix the merge order: combine the raw user opts with the raw route opts first, then pass the result through
processCompressParams/processDecompressParamsonce so each derived field is computed from a coherent input rather than shallow-merged from already-processed objects.Adds unit tests covering both decompress hook fallbacks and the compress
onUnsupportedEncodingfallback.Closes #340
Checklist
npm run test && npm run benchmark --if-presentand the Code of conduct