Fixed content-type in channels::create + list response header

This commit is contained in:
shockrah 2020-11-07 21:01:09 -08:00
parent c8a6aa204d
commit 06a76b26df

View File

@ -21,8 +21,8 @@ pub async fn list_channels(pool: &Pool, response: &mut Response<Body>) {
*/
return match db::channels::Channel::filter(pool, 0).await {
db::Response::Set(channels) => {
response.headers_mut().insert("Content type",
HeaderValue::from_static("json/application"));
response.headers_mut().insert("Content-Type",
HeaderValue::from_static("application/json"));
*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(?)
match db::channels::Channel::add(pool, name, desc, kind.try_into().unwrap()).await {
db::Response::Row(row) => {
response.headers_mut().insert("Content type",
HeaderValue::from_static("json/application"));
response.headers_mut().insert("Content-Type",
HeaderValue::from_static("application/json"));
*response.body_mut() = Body::from(to_string(&row).unwrap_or("{}".into()));
},