From cc49b5e0d80f0c27e90af6ae520a0fec59e577c6 Mon Sep 17 00:00:00 2001 From: Divy Srivastava Date: Mon, 4 Apr 2022 15:19:35 +0530 Subject: [PATCH] chore(ext/http): custom arity (#14200) --- ext/http/01_http.js | 4 +++- 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 7db3fdbe8b..2ab2fea7b0 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 f0b4588c61..9c0109937a 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>, - args: RespondArgs, + rid: u32, + status: u16, + headers: Vec<(ByteString, ByteString)>, data: Option, ) -> Result<(), AnyError> { - let RespondArgs(rid, status, headers) = args; let stream = state .borrow_mut() .resource_table