mirror of
https://codeberg.org/yeentown/barkey.git
synced 2025-07-07 12:36:57 +00:00
fix hook targets
This commit is contained in:
parent
89cab66898
commit
cbe88122b9
1 changed files with 2 additions and 2 deletions
|
@ -28,7 +28,7 @@ export class ServerUtilityService {
|
||||||
|
|
||||||
// Default behavior saves files to memory - we don't want that!
|
// Default behavior saves files to memory - we don't want that!
|
||||||
// Store to temporary file instead, and copy the body fields while we're at it.
|
// Store to temporary file instead, and copy the body fields while we're at it.
|
||||||
fastify.addHook<{ Body?: Record<string, string | string[] | undefined> }>('onRequest', async request => {
|
fastify.addHook<{ Body?: Record<string, string | string[] | undefined> }>('preValidation', async request => {
|
||||||
if (request.isMultipart()) {
|
if (request.isMultipart()) {
|
||||||
// We can't use saveRequestFiles() because it erases all the data fields.
|
// We can't use saveRequestFiles() because it erases all the data fields.
|
||||||
// Instead, recreate it manually.
|
// Instead, recreate it manually.
|
||||||
|
@ -94,7 +94,7 @@ export class ServerUtilityService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public addCORS(fastify: FastifyInstance) {
|
public addCORS(fastify: FastifyInstance) {
|
||||||
fastify.addHook('onRequest', (_, reply, done) => {
|
fastify.addHook('preHandler', (_, reply, done) => {
|
||||||
// Allow web-based clients to connect from other origins.
|
// Allow web-based clients to connect from other origins.
|
||||||
reply.header('Access-Control-Allow-Origin', '*');
|
reply.header('Access-Control-Allow-Origin', '*');
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue