File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -8,15 +8,18 @@ const fp = require('fastify-plugin');
8
8
9
9
const podiumLayoutFastifyPlugin = ( fastify , layout , done ) => {
10
10
// Decorate reply with .app.podium we can write to throught the request
11
- fastify . decorateReply ( 'app' , {
12
- podium : { } ,
11
+ fastify . decorateReply ( 'app' , null ) ;
12
+ fastify . addHook ( 'onRequest' , async ( request , reply ) => {
13
+ reply . app = {
14
+ podium : { } ,
15
+ }
13
16
} ) ;
14
17
15
18
// Run parsers on request and store state object on reply.app.podium
16
- fastify . addHook ( 'onRequest ' , async ( request , reply ) => {
19
+ fastify . addHook ( 'preHandler ' , async ( request , reply ) => {
17
20
const incoming = new utils . HttpIncoming (
18
- request . req ,
19
- reply . res ,
21
+ request . raw ,
22
+ reply . raw ,
20
23
reply . app . params ,
21
24
) ;
22
25
reply . app . podium = await layout . process ( incoming , { proxy : false } ) ;
You can’t perform that action at this time.
0 commit comments