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

This commit is contained in:
Dmitry 2025-12-15 01:10:05 +03:00
parent 8ce8569625
commit 48cd5ca836

View file

@ -83,10 +83,18 @@ class MnemoShelf {
// Process the request and add CORS headers to response
final response = await innerHandler(request);
return response.change(headers: {
...response.headers,
...corsConfig,
// Explicitly merge headers to ensure CORS headers are always added
// 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);
};
};
}