Skip to content

Commit

Permalink
style: remove trailing whitespace (#170)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fdawgs authored Nov 3, 2024
1 parent bb5ac7c commit c68d430
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,14 +199,14 @@ function getToken (req) {
It is recommended to provide a custom `getToken` function for performance and [security](https://cheatsheetseries.owasp.org/cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.html#use-of-custom-request-headers) reasons.

```js
fastify.register(require('@fastify/csrf-protection'),
fastify.register(require('@fastify/csrf-protection'),
{ getToken: function (req) { return req.headers['csrf-token'] } }
)
```
or

```js
fastify.register(require('@fastify/csrf-protection'),
fastify.register(require('@fastify/csrf-protection'),
{ getToken: (req) => req.headers['csrf-token'] }
)
```
Expand Down
4 changes: 2 additions & 2 deletions examples/example.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ fastify.route({
body: JSON.stringify({ _csrf: '${token}'})
});
const content = await rawResponse.json();
alert(JSON.stringify(content));
}
</script>
Expand All @@ -51,7 +51,7 @@ fastify.route({
</form>
</body>
</html>
`
}
})
Expand Down
2 changes: 1 addition & 1 deletion types/index.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ async function run() {
return req.body
}
})

fastify.addHook('onRequest', fastify.csrfProtection)
}

Expand Down

0 comments on commit c68d430

Please sign in to comment.