Skip to content

Commit d89ed78

Browse files
authored
Clarify example for Fastify (#311)
Some linters (or personal preference) remove `async` from functions if there are no `await` or return a `Promise` object. This, with some bad errors management in Fastify, has lead me to two full week of head banging. With the sync signature, it gets more explicit that the body parsing always succeed by doing nothing. Note: `null` is needed due to how Typescript types are defined, for regular Javascript just calling `done()` should works.
1 parent f6670b0 commit d89ed78

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ const fastify = require('fastify')({ logger: true });
126126
* @see https://www.fastify.io/docs/latest/Reference/ContentTypeParser/
127127
*/
128128
fastify.addContentTypeParser(
129-
'application/offset+octet-stream', async () => true
129+
'application/offset+octet-stream', (request, payload, done) => done(null)
130130
);
131131

132132
/**

0 commit comments

Comments
 (0)