From d771cb22e03d5213c9d442d5b7a7560b90ec5b0d Mon Sep 17 00:00:00 2001 From: Kyle Espinola Date: Sun, 8 Oct 2023 15:40:32 +0200 Subject: [PATCH] refactor: send metadata json as json post --- api/src/hub_uploads.rs | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/api/src/hub_uploads.rs b/api/src/hub_uploads.rs index 9d5ceb9..a9d7c67 100644 --- a/api/src/hub_uploads.rs +++ b/api/src/hub_uploads.rs @@ -4,10 +4,7 @@ use hub_core::{ clap, prelude::*, }; -use reqwest::{ - multipart::{Form, Part}, - Response, -}; +use reqwest::Response; use serde::{Deserialize, Serialize}; /// Arguments for establishing a nft storage connection @@ -49,14 +46,9 @@ impl HubUploadClient { async fn post(&self, endpoint: String, body: impl Serialize) -> Result { let url = self.api_base_url.join(&endpoint)?; - let serialized_body = serde_json::to_vec(&body).context("failed to serialize body")?; - let part = Part::bytes(serialized_body).file_name("file_name.extension"); - - let form = Form::new().part("file", part); - self.http .post(url) - .multipart(form) + .json(&body) .send() .await .context("failed to send post request")