Skip to content

Commit

Permalink
aw-server: Set content type for more endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
johan-bjareholt committed Apr 15, 2020
1 parent e15fe1c commit 00c001b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions aw-server/src/endpoints/bucket.rs
Expand Up @@ -50,7 +50,7 @@ pub fn bucket_get(bucket_id: String, state: State<ServerState>) -> Result<Json<B
// FIXME: The status::Custom return is used because if we simply used Status and return a
// Status::NotModified rocket will for some unknown reason consider that to be a
// "Invalid status used as responder" and converts it to a 500 which we do not want.
#[post("/<bucket_id>", data = "<message>")]
#[post("/<bucket_id>", data = "<message>", format = "application/json")]
pub fn bucket_new(
bucket_id: String,
message: Json<Bucket>,
Expand Down Expand Up @@ -130,7 +130,7 @@ pub fn bucket_events_get(
}
}

#[post("/<bucket_id>/events", data = "<events>")]
#[post("/<bucket_id>/events", data = "<events>", format = "application/json")]
pub fn bucket_events_create(
bucket_id: String,
events: Json<Vec<Event>>,
Expand All @@ -150,7 +150,7 @@ pub fn bucket_events_create(
}
}

#[post("/<bucket_id>/heartbeat?<pulsetime>", data = "<heartbeat_json>")]
#[post("/<bucket_id>/heartbeat?<pulsetime>", data = "<heartbeat_json>", format = "application/json")]
pub fn bucket_events_heartbeat(
bucket_id: String,
heartbeat_json: Json<Event>,
Expand Down
2 changes: 1 addition & 1 deletion aw-server/src/endpoints/query.rs
Expand Up @@ -30,7 +30,7 @@ fn error(err: QueryError) -> status::Custom<JsonValue> {
status::Custom(Status::InternalServerError, json!(body))
}

#[post("/", data = "<query_req>")]
#[post("/", data = "<query_req>", format = "application/json")]
pub fn query(query_req: Json<Query>, state: State<ServerState>) -> status::Custom<JsonValue> {
let query_code = query_req.0.query.join("\n");
let intervals = &query_req.0.timeperiods;
Expand Down
2 changes: 1 addition & 1 deletion aw-server/src/endpoints/settings.rs
Expand Up @@ -16,7 +16,7 @@ fn parse_key(key: String) -> Result<String, Status> {
}
}

#[post("/", data = "<message>")]
#[post("/", data = "<message>", format = "application/json")]
pub fn setting_set(state: State<ServerState>, message: Json<KeyValue>) -> Result<Status, Status> {
let data = message.into_inner();

Expand Down

0 comments on commit 00c001b

Please sign in to comment.