mirror of
https://github.com/mimblewimble/grin.git
synced 2025-01-21 03:21:08 +03:00
fix: specify allowed headers on http responses (#2184)
This commit is contained in:
parent
c45486f2b9
commit
3092221997
1 changed files with 3 additions and 1 deletions
|
@ -645,7 +645,7 @@ fn create_error_response(e: Error) -> Response<Body> {
|
||||||
Response::builder()
|
Response::builder()
|
||||||
.status(StatusCode::INTERNAL_SERVER_ERROR)
|
.status(StatusCode::INTERNAL_SERVER_ERROR)
|
||||||
.header("access-control-allow-origin", "*")
|
.header("access-control-allow-origin", "*")
|
||||||
.header("access-control-allow-headers", "Content-Type")
|
.header("access-control-allow-headers", "Content-Type, Authorization")
|
||||||
.body(format!("{}", e).into())
|
.body(format!("{}", e).into())
|
||||||
.unwrap()
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
@ -654,6 +654,7 @@ fn create_ok_response(json: &str) -> Response<Body> {
|
||||||
Response::builder()
|
Response::builder()
|
||||||
.status(StatusCode::OK)
|
.status(StatusCode::OK)
|
||||||
.header("access-control-allow-origin", "*")
|
.header("access-control-allow-origin", "*")
|
||||||
|
.header("access-control-allow-headers", "Content-Type, Authorization")
|
||||||
.body(json.to_string().into())
|
.body(json.to_string().into())
|
||||||
.unwrap()
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
@ -662,6 +663,7 @@ fn response<T: Into<Body>>(status: StatusCode, text: T) -> Response<Body> {
|
||||||
Response::builder()
|
Response::builder()
|
||||||
.status(status)
|
.status(status)
|
||||||
.header("access-control-allow-origin", "*")
|
.header("access-control-allow-origin", "*")
|
||||||
|
.header("access-control-allow-headers", "Content-Type, Authorization")
|
||||||
.body(text.into())
|
.body(text.into())
|
||||||
.unwrap()
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue