diff options
author | Divy Srivastava <dj.srivastava23@gmail.com> | 2022-04-04 15:19:35 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-04 15:19:35 +0530 |
commit | cc49b5e0d80f0c27e90af6ae520a0fec59e577c6 (patch) | |
tree | f31463336c7b02ede9d6901ad16bfde8f3a6abb2 | |
parent | 6bb555b549a203ebe921260379f3da70787be655 (diff) |
chore(ext/http): custom arity (#14200)
-rw-r--r-- | ext/http/01_http.js | 4 | ||||
-rw-r--r-- | ext/http/lib.rs | 17 |
2 files changed, 6 insertions, 15 deletions
diff --git a/ext/http/01_http.js b/ext/http/01_http.js index 7db3fdbe8..2ab2fea7b 100644 --- a/ext/http/01_http.js +++ b/ext/http/01_http.js @@ -239,7 +239,9 @@ try { await core.opAsync( "op_http_write_headers", - [streamRid, innerResp.status ?? 200, innerResp.headerList], + streamRid, + innerResp.status ?? 200, + innerResp.headerList, isStreamingResponseBody ? null : respBody, ); } catch (error) { diff --git a/ext/http/lib.rs b/ext/http/lib.rs index f0b4588c6..9c0109937 100644 --- a/ext/http/lib.rs +++ b/ext/http/lib.rs @@ -43,7 +43,6 @@ use hyper::service::Service; use hyper::Body; use hyper::Request; use hyper::Response; -use serde::Deserialize; use serde::Serialize; use std::borrow::Cow; use std::cell::RefCell; @@ -481,24 +480,14 @@ fn req_headers( headers } -// We use a tuple instead of struct to avoid serialization overhead of the keys. -#[derive(Deserialize)] -struct RespondArgs( - // rid: - u32, - // status: - u16, - // headers: - Vec<(ByteString, ByteString)>, -); - #[op] async fn op_http_write_headers( state: Rc<RefCell<OpState>>, - args: RespondArgs, + rid: u32, + status: u16, + headers: Vec<(ByteString, ByteString)>, data: Option<StringOrBuffer>, ) -> Result<(), AnyError> { - let RespondArgs(rid, status, headers) = args; let stream = state .borrow_mut() .resource_table |