Skip to content

Commit 4f2e199

Browse files
kovalenpUzlopak
andauthored
Applied suggestion to refactor preValidation conditions
Co-authored-by: Uzlopak <[email protected]>
1 parent 1ff3b11 commit 4f2e199

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

index.js

+3-5
Original file line numberDiff line numberDiff line change
@@ -260,13 +260,11 @@ async function fastifyHttpProxy (fastify, opts) {
260260

261261
fastify.register(From, fromOpts)
262262

263-
if (opts.preValidation === undefined && opts.proxyPayloads !== false) {
264-
fastify.addContentTypeParser('application/json', bodyParser)
265-
fastify.addContentTypeParser('*', bodyParser)
266-
}
267-
268263
if (opts.preValidation) {
269264
fastify.addHook('preValidation', opts.preValidation)
265+
} else if (opts.proxyPayloads !== false) {
266+
fastify.addContentTypeParser('application/json', bodyParser)
267+
fastify.addContentTypeParser('*', bodyParser)
270268
}
271269

272270
function rewriteHeaders (headers, req) {

0 commit comments

Comments
 (0)