use reqwest json() method

This commit is contained in:
Giacomo Pasini 2023-11-10 20:15:28 +01:00
parent 421ea6c0c7
commit db7054c71c
No known key found for this signature in database
GPG Key ID: FC08489D2D895D4B
3 changed files with 5 additions and 8 deletions

View File

@ -10,8 +10,7 @@ pub async fn get_blobs(
const BLOBS_PATH: &str = "da/blobs";
CLIENT
.post(node.join(BLOBS_PATH).unwrap())
.header("Content-Type", "application/json")
.body(serde_json::to_string(&ids).unwrap())
.json(&ids)
.send()
.await?
.json()

View File

@ -9,8 +9,7 @@ where
const NODE_CERT_PATH: &str = "mempool/add/cert";
CLIENT
.post(node.join(NODE_CERT_PATH).unwrap())
.header("Content-Type", "application/json")
.body(serde_json::to_string(cert).unwrap())
.json(cert)
.send()
.await
}

View File

@ -10,12 +10,11 @@ pub async fn get_block_contents(
block: &BlockId,
) -> Result<Option<Block<Tx, Certificate>>, reqwest::Error> {
const BLOCK_PATH: &str = "storage/block";
let block = CLIENT
CLIENT
.post(node.join(BLOCK_PATH).unwrap())
.body(serde_json::to_string(block).unwrap())
.json(block)
.send()
.await?
.json()
.await?;
Ok(block)
.await
}