Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 10/8 #248

Merged
merged 2 commits into from
Oct 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading