0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-10-29 08:58:01 -04: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; const url = input as string;
log("dispatch FETCH_REQ", url); log("dispatch FETCH_REQ", url);
// Send FetchReq message // Send Fetch message
const builder = flatbuffers.createBuilder(); const builder = flatbuffers.createBuilder();
const url_ = builder.createString(url); const url_ = builder.createString(url);
msg.FetchReq.startFetchReq(builder); msg.Fetch.startFetch(builder);
msg.FetchReq.addUrl(builder, url_); msg.Fetch.addUrl(builder, url_);
const resBase = await sendAsync( const resBase = await sendAsync(
builder, builder,
msg.Any.FetchReq, msg.Any.Fetch,
msg.FetchReq.endFetchReq(builder) msg.Fetch.endFetch(builder)
); );
// Decode FetchRes // Decode FetchRes

View file

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

View file

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