use reqwest json() method (#525)

This commit is contained in:
Giacomo Pasini 2023-11-11 16:49:18 +01:00 committed by GitHub
parent 421ea6c0c7
commit a524cc2dcf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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
}