Skip to content

Commit 00c001b

Browse files
aw-server: Set content type for more endpoints
1 parent e15fe1c commit 00c001b

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

aw-server/src/endpoints/bucket.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ pub fn bucket_get(bucket_id: String, state: State<ServerState>) -> Result<Json<B
5050
// FIXME: The status::Custom return is used because if we simply used Status and return a
5151
// Status::NotModified rocket will for some unknown reason consider that to be a
5252
// "Invalid status used as responder" and converts it to a 500 which we do not want.
53-
#[post("/<bucket_id>", data = "<message>")]
53+
#[post("/<bucket_id>", data = "<message>", format = "application/json")]
5454
pub fn bucket_new(
5555
bucket_id: String,
5656
message: Json<Bucket>,
@@ -130,7 +130,7 @@ pub fn bucket_events_get(
130130
}
131131
}
132132

133-
#[post("/<bucket_id>/events", data = "<events>")]
133+
#[post("/<bucket_id>/events", data = "<events>", format = "application/json")]
134134
pub fn bucket_events_create(
135135
bucket_id: String,
136136
events: Json<Vec<Event>>,
@@ -150,7 +150,7 @@ pub fn bucket_events_create(
150150
}
151151
}
152152

153-
#[post("/<bucket_id>/heartbeat?<pulsetime>", data = "<heartbeat_json>")]
153+
#[post("/<bucket_id>/heartbeat?<pulsetime>", data = "<heartbeat_json>", format = "application/json")]
154154
pub fn bucket_events_heartbeat(
155155
bucket_id: String,
156156
heartbeat_json: Json<Event>,

aw-server/src/endpoints/query.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ fn error(err: QueryError) -> status::Custom<JsonValue> {
3030
status::Custom(Status::InternalServerError, json!(body))
3131
}
3232

33-
#[post("/", data = "<query_req>")]
33+
#[post("/", data = "<query_req>", format = "application/json")]
3434
pub fn query(query_req: Json<Query>, state: State<ServerState>) -> status::Custom<JsonValue> {
3535
let query_code = query_req.0.query.join("\n");
3636
let intervals = &query_req.0.timeperiods;

aw-server/src/endpoints/settings.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ fn parse_key(key: String) -> Result<String, Status> {
1616
}
1717
}
1818

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

0 commit comments

Comments
 (0)