Skip to content
This repository has been archived by the owner on Oct 8, 2024. It is now read-only.

Commit

Permalink
fix: body enters twice into options
Browse files Browse the repository at this point in the history
  • Loading branch information
PThorpe92 committed Apr 29, 2024
1 parent dc09c0d commit ad1195e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ impl<'a> Default for App<'a> {
}

impl<'a> App<'a> {
#[allow(dead_code)]
fn new_test_db() -> Self {
Self {
db: Box::new(DB::new_test().expect("Failed to create database")),
Expand Down
3 changes: 3 additions & 0 deletions src/request/curl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,9 @@ impl Curl {
if self.ser {
self.opts.push(AppOptions::RequestBody(body.to_string()));
}
if self.opts.iter().any(|x| std::mem::discriminant(x) == std::mem::discriminant(&AppOptions::RequestBody(body.to_string()))) {
self.opts.retain(|x| std::mem::discriminant(x) != std::mem::discriminant(&AppOptions::RequestBody(body.to_string())));
}
self.opts.push(AppOptions::RequestBody(body.to_string()));
self.curl
.post_fields_copy(body.as_bytes())
Expand Down

0 comments on commit ad1195e

Please sign in to comment.