Fixed content-type in channels::create + list response header
This commit is contained in:
parent
c8a6aa204d
commit
06a76b26df
@ -21,8 +21,8 @@ pub async fn list_channels(pool: &Pool, response: &mut Response<Body>) {
|
|||||||
*/
|
*/
|
||||||
return match db::channels::Channel::filter(pool, 0).await {
|
return match db::channels::Channel::filter(pool, 0).await {
|
||||||
db::Response::Set(channels) => {
|
db::Response::Set(channels) => {
|
||||||
response.headers_mut().insert("Content type",
|
response.headers_mut().insert("Content-Type",
|
||||||
HeaderValue::from_static("json/application"));
|
HeaderValue::from_static("application/json"));
|
||||||
|
|
||||||
*response.body_mut() = Body::from(to_string(&channels).unwrap_or("{}".into()))
|
*response.body_mut() = Body::from(to_string(&channels).unwrap_or("{}".into()))
|
||||||
},
|
},
|
||||||
@ -52,8 +52,8 @@ pub async fn create_channel(pool: &Pool, response: &mut Response<Body>, params:
|
|||||||
// Send the data up to the db, then return the new channel back to the user(?)
|
// Send the data up to the db, then return the new channel back to the user(?)
|
||||||
match db::channels::Channel::add(pool, name, desc, kind.try_into().unwrap()).await {
|
match db::channels::Channel::add(pool, name, desc, kind.try_into().unwrap()).await {
|
||||||
db::Response::Row(row) => {
|
db::Response::Row(row) => {
|
||||||
response.headers_mut().insert("Content type",
|
response.headers_mut().insert("Content-Type",
|
||||||
HeaderValue::from_static("json/application"));
|
HeaderValue::from_static("application/json"));
|
||||||
|
|
||||||
*response.body_mut() = Body::from(to_string(&row).unwrap_or("{}".into()));
|
*response.body_mut() = Body::from(to_string(&row).unwrap_or("{}".into()));
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user