Skip to content

Commit

Permalink
Merge pull request #248 from holaplex/main
Browse files Browse the repository at this point in the history
Release 10/8
  • Loading branch information
kespinola authored Oct 8, 2023
2 parents 81c6322 + 3e32bdc commit 2631187
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions api/src/hub_uploads.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -49,14 +46,9 @@ impl HubUploadClient {
async fn post(&self, endpoint: String, body: impl Serialize) -> Result<Response> {
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")
Expand Down

0 comments on commit 2631187

Please sign in to comment.