Skip to content

Commit 6eb4891

Browse files
author
bortyr
committed
fix: add json header
1 parent 5e5dd91 commit 6eb4891

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/main.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use rand::{thread_rng, Rng};
22
use reqwest::blocking::Client;
3+
use reqwest::header::CONTENT_TYPE;
34
use serde::{Serialize, Deserialize};
45
use std::fmt;
56

@@ -101,7 +102,9 @@ fn main() {
101102
println!("Sending POST request to {} as JSON: {}", URL, json);
102103

103104
let client = Client::new();
104-
let res = client.post(URL)
105+
let res = client
106+
.post(URL)
107+
.header(CONTENT_TYPE, "application/json")
105108
.body(json)
106109
.send();
107110

0 commit comments

Comments
 (0)