mirror of
https://github.com/logto-io/logto.git
synced 2025-01-06 20:40:08 -05:00
refactor(core): fix CORS (#3246)
This commit is contained in:
parent
1418ef84c1
commit
bd158a46fe
2 changed files with 2 additions and 2 deletions
|
@ -23,7 +23,7 @@ const { default: koaCors } = await import('./koa-cors.js');
|
|||
const noop = async () => {};
|
||||
|
||||
const mockContext = (method: RequestMethod, url: string) => {
|
||||
const ctx = createMockContext({ method, url });
|
||||
const ctx = createMockContext({ method, headers: { origin: new URL(url).origin } });
|
||||
|
||||
const setSpy = jest.spyOn(ctx, 'set');
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ export default function koaCors<StateT, ContextT, ResponseBodyT>(
|
|||
): MiddlewareType<StateT, ContextT, ResponseBodyT> {
|
||||
return cors({
|
||||
origin: (ctx) => {
|
||||
const { origin } = ctx;
|
||||
const { origin } = ctx.request.headers;
|
||||
|
||||
if (
|
||||
origin &&
|
||||
|
|
Loading…
Reference in a new issue