From 61f3da3161879ca60d5076c8965ca71b9f9549b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Thu, 9 Apr 2020 16:28:27 +0200 Subject: [PATCH] async_client: Add the content-type header to our requests. --- src/async_client.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/async_client.rs b/src/async_client.rs index f5bb1906..828a1663 100644 --- a/src/async_client.rs +++ b/src/async_client.rs @@ -576,11 +576,17 @@ impl AsyncClient { HttpMethod::GET => self.http_client.get(url), HttpMethod::POST => { let body = request.body().clone(); - self.http_client.post(url).body(body) + self.http_client + .post(url) + .body(body) + .header(reqwest::header::CONTENT_TYPE, "application/json") } HttpMethod::PUT => { let body = request.body().clone(); - self.http_client.put(url).body(body) + self.http_client + .put(url) + .body(body) + .header(reqwest::header::CONTENT_TYPE, "application/json") } HttpMethod::DELETE => unimplemented!(), _ => panic!("Unsuported method"),