Skip to content

Commit d3c6b93

Browse files
committedApr 24, 2020
fix(): serveStaticOptions is not correctly passed to fastify-static
1 parent 667f1a6 commit d3c6b93

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed
 

Diff for: ‎lib/loaders/fastify.loader.ts

+3-9
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,16 @@ export class FastifyLoader extends AbstractLoader {
2323
() => require('fastify-static')
2424
);
2525

26-
optionsArr.forEach(options => {
26+
optionsArr.forEach((options) => {
2727
options.renderPath = options.renderPath || DEFAULT_RENDER_PATH;
2828

29-
const { setHeaders, redirect, ...send } =
30-
options.serveStaticOptions || ({} as any);
3129
const clientPath = options.rootPath || DEFAULT_ROOT_PATH;
3230
const indexFilePath = this.getIndexFilePath(clientPath);
3331

3432
if (options.serveRoot) {
3533
app.register(fastifyStatic, {
3634
root: clientPath,
37-
setHeaders,
38-
redirect,
39-
send,
35+
...options.serveStaticOptions,
4036
wildcard: false,
4137
prefix: options.serveRoot
4238
});
@@ -53,9 +49,7 @@ export class FastifyLoader extends AbstractLoader {
5349
} else {
5450
app.register(fastifyStatic, {
5551
root: clientPath,
56-
setHeaders,
57-
redirect,
58-
send,
52+
...options.serveStaticOptions,
5953
wildcard: false
6054
});
6155
app.get(options.renderPath, (req: any, res: any) => {

0 commit comments

Comments
 (0)
Please sign in to comment.