Fix: Allow legacy headers in CORS ()

Co-authored-by: Gerard Guillemas Martos <gerard@DESKTOP-6S0AS7R>
This commit is contained in:
Gerard Guillemas Martos 2024-03-22 21:50:01 +01:00 committed by GitHub
parent ab3582d057
commit 0985b1e18d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -35,7 +35,7 @@ use http::header;
use std::net::SocketAddr;
use std::sync::Arc;
use std::time::Duration;
use surrealdb::headers::{DB, ID, NS};
use surrealdb::headers::{AUTH_DB, AUTH_NS, DB, DB_LEGACY, ID, ID_LEGACY, NS, NS_LEGACY};
use tokio_util::sync::CancellationToken;
use tower::ServiceBuilder;
use tower_http::add_extension::AddExtensionLayer;
@ -106,6 +106,12 @@ pub async fn init(ct: CancellationToken) -> Result<(), Error> {
NS.clone(),
DB.clone(),
ID.clone(),
AUTH_NS.clone(),
AUTH_DB.clone(),
// TODO(gguillemas): Remove these headers once the legacy authentication is deprecated in v2.0.0
NS_LEGACY.clone(),
DB_LEGACY.clone(),
ID_LEGACY.clone(),
];
#[cfg(not(feature = "http-compression"))]
@ -117,6 +123,12 @@ pub async fn init(ct: CancellationToken) -> Result<(), Error> {
NS.clone(),
DB.clone(),
ID.clone(),
AUTH_NS.clone(),
AUTH_DB.clone(),
// TODO(gguillemas): Remove these headers once the legacy authentication is deprecated in v2.0.0
NS_LEGACY.clone(),
DB_LEGACY.clone(),
ID_LEGACY.clone(),
];
let service = service