[O] CORS allow
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
use std::path::PathBuf;
|
||||
use hyper::{Body, http, Response, StatusCode};
|
||||
use hyper::{Body, header, http, Response, StatusCode};
|
||||
|
||||
pub trait StringExt {
|
||||
fn resp(&self, status: u16) -> http::Result<Response<Body>>;
|
||||
@@ -7,7 +7,8 @@ pub trait StringExt {
|
||||
|
||||
impl StringExt for String {
|
||||
fn resp(&self, status: u16) -> http::Result<Response<Body>> {
|
||||
Response::builder().status(StatusCode::from_u16(status).unwrap()).body(Body::from(self.to_owned()))
|
||||
Response::builder().header(header::ACCESS_CONTROL_ALLOW_ORIGIN, "*")
|
||||
.status(StatusCode::from_u16(status).unwrap()).body(Body::from(self.to_owned()))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user