Fast follows on 0.34 (#9034)
Co-authored-by: Weiko <corentin@twenty.com>
This commit is contained in:
@ -11,7 +11,7 @@ import { Response } from 'express';
|
||||
// the CORS headers are missing in the response.
|
||||
// This class add CORS headers to exception response to avoid misleading CORS error
|
||||
@Catch()
|
||||
export class ApplyCorsToExceptions implements ExceptionFilter {
|
||||
export class UnhandledExceptionFilter implements ExceptionFilter {
|
||||
catch(exception: any, host: ArgumentsHost) {
|
||||
const ctx = host.switchToHttp();
|
||||
const response = ctx.getResponse<Response>();
|
||||
@ -20,6 +20,7 @@ export class ApplyCorsToExceptions implements ExceptionFilter {
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: Check if needed, remove otherwise.
|
||||
response.header('Access-Control-Allow-Origin', '*');
|
||||
response.header(
|
||||
'Access-Control-Allow-Methods',
|
||||
|
||||
Reference in New Issue
Block a user