Skip to content

Commit

Permalink
HTTP client drop support for hex body
Browse files Browse the repository at this point in the history
  • Loading branch information
kvinwang committed Mar 1, 2024
1 parent 5ba16a7 commit 55069bc
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions sidevm-quickjs/src/host_functions/http_request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,8 @@ pub struct HttpRequest {
method: String,
#[qjsbind(default)]
headers: Headers,
#[qjsbind(default, as_bytes)]
body: Vec<u8>,
text_body: Option<String>,
#[qjsbind(default)]
body: js::BytesOrString,
#[qjsbind(default = "default_timeout")]
timeout_ms: u64,
}
Expand Down Expand Up @@ -147,11 +146,7 @@ async fn do_http_request_inner(
let mut builder = hyper::Request::builder()
.method(req.method.to_uppercase().as_str())
.uri(&uri);
let body: Vec<u8> = if let Some(text_body) = req.text_body {
text_body.into_bytes()
} else {
req.body
};
let body = req.body.as_bytes().to_vec();
for (k, v) in req.headers.pairs.iter() {
builder = builder.header(k.as_str(), v.as_str());
}
Expand Down

0 comments on commit 55069bc

Please sign in to comment.