1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-22 15:06:54 -05:00

Rename FetchReq op to Fetch.

This commit is contained in:
Ryan Dahl 2018-10-30 15:02:18 -04:00
parent 3b4dfd8bb5
commit 80b5c61460
3 changed files with 11 additions and 11 deletions

View file

@ -199,15 +199,15 @@ export async function fetch(
const url = input as string;
log("dispatch FETCH_REQ", url);
// Send FetchReq message
// Send Fetch message
const builder = flatbuffers.createBuilder();
const url_ = builder.createString(url);
msg.FetchReq.startFetchReq(builder);
msg.FetchReq.addUrl(builder, url_);
msg.Fetch.startFetch(builder);
msg.Fetch.addUrl(builder, url_);
const resBase = await sendAsync(
builder,
msg.Any.FetchReq,
msg.FetchReq.endFetchReq(builder)
msg.Any.Fetch,
msg.Fetch.endFetch(builder)
);
// Decode FetchRes

View file

@ -8,7 +8,7 @@ union Any {
Exit,
Environ,
EnvironRes,
FetchReq,
Fetch,
FetchRes,
MakeTempDir,
MakeTempDirRes,
@ -190,9 +190,10 @@ table EnvPair {
value: string;
}
table FetchReq {
table Fetch {
id: uint;
url: string;
// TODO Supply request headers:
// header_line: [string];
}

View file

@ -83,7 +83,7 @@ pub fn dispatch(
msg::Any::Dial => op_dial,
msg::Any::Environ => op_env,
msg::Any::Exit => op_exit,
msg::Any::FetchReq => op_fetch_req,
msg::Any::Fetch => op_fetch,
msg::Any::Listen => op_listen,
msg::Any::MakeTempDir => op_make_temp_dir,
msg::Any::Metrics => op_metrics,
@ -390,18 +390,17 @@ fn op_env(
))
}
fn op_fetch_req(
fn op_fetch(
state: Arc<IsolateState>,
base: &msg::Base,
data: &'static mut [u8],
) -> Box<Op> {
assert_eq!(data.len(), 0);
let inner = base.inner_as_fetch_req().unwrap();
let inner = base.inner_as_fetch().unwrap();
let cmd_id = base.cmd_id();
let id = inner.id();
let url = inner.url().unwrap();
// FIXME use domain (or use this inside check_net)
if let Err(e) = state.check_net(url) {
return odd_future(e);
}