Skip to content

Commit

Permalink
Add multipart content type
Browse files Browse the repository at this point in the history
  • Loading branch information
jellejurre committed Nov 11, 2024
1 parent af466f2 commit 851d987
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ sed -i 's/Result<models::CurrentUser, Error<GetCurrentUserError>>/Result<models:
# https://github.com/vrchatapi/vrchatapi-rust/pull/29
sed -i "s/local_var_req_builder = local_var_req_builder.json(&\(.*\));/if let Some(\1) = \1 { \0 }/g" src/apis/files_api.rs

sed -i 's|// TODO: support file upload for '\''file'\'' parameter|let part = reqwest::multipart::Part::bytes(std::fs::read(\&file).unwrap()).file_name(file.file_name().unwrap().to_string_lossy().to_string()).mime_str(if file.file_name().unwrap().to_string_lossy().to_string().ends_with("png") { "image/png" } else { "application/octet-stream" })?;\n\tlocal_var_form = local_var_form.part("file", part);|' src/apis/files_api.rs

cargo fmt
cargo build
cargo test

0 comments on commit 851d987

Please sign in to comment.