1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-30 16:40:57 -05:00

chore(ext/http): custom arity (#14200)

This commit is contained in:
Divy Srivastava 2022-04-04 15:19:35 +05:30 committed by David Sherret
parent 71cbb8be70
commit 0a0a00886f
2 changed files with 6 additions and 15 deletions

View file

@ -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) {

View file

@ -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