errors
Some checks are pending
Backend CI / test (push) Waiting to run
Backend CI / build (push) Blocked by required conditions
Deploy Mnemo Cards / Deploy Backend (push) Waiting to run
Deploy Mnemo Cards / Deploy Web App (push) Blocked by required conditions
Deploy Mnemo Cards / Final Verification (push) Blocked by required conditions
Some checks are pending
Backend CI / test (push) Waiting to run
Backend CI / build (push) Blocked by required conditions
Deploy Mnemo Cards / Deploy Backend (push) Waiting to run
Deploy Mnemo Cards / Deploy Web App (push) Blocked by required conditions
Deploy Mnemo Cards / Final Verification (push) Blocked by required conditions
This commit is contained in:
parent
8ce8569625
commit
48cd5ca836
1 changed files with 11 additions and 3 deletions
|
|
@ -83,10 +83,18 @@ class MnemoShelf {
|
||||||
|
|
||||||
// Process the request and add CORS headers to response
|
// Process the request and add CORS headers to response
|
||||||
final response = await innerHandler(request);
|
final response = await innerHandler(request);
|
||||||
return response.change(headers: {
|
|
||||||
...response.headers,
|
// Explicitly merge headers to ensure CORS headers are always added
|
||||||
...corsConfig,
|
// This guarantees CORS headers are present even for error responses (401, 403, etc.)
|
||||||
|
final finalHeaders = <String, String>{};
|
||||||
|
// First, add existing response headers
|
||||||
|
finalHeaders.addAll(response.headers);
|
||||||
|
// Then, add/override with CORS headers (they take priority)
|
||||||
|
corsConfig.forEach((key, value) {
|
||||||
|
finalHeaders[key] = value;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
return response.change(headers: finalHeaders);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue