Rename fetch() to more descriptive name

This commit is contained in:
benthecarman
2023-02-21 00:58:19 -06:00
parent 5400d15880
commit 82430fb991

View File

@@ -59,7 +59,7 @@ pub async fn main(req: Request, env: Env, _ctx: Context) -> Result<Response> {
{ {
Some(_) => { Some(_) => {
console_log!("event already published: {}", event.id); console_log!("event already published: {}", event.id);
return fetch(); return empty_response();
} }
None => {} None => {}
}; };
@@ -107,7 +107,7 @@ pub async fn main(req: Request, env: Env, _ctx: Context) -> Result<Response> {
} }
} }
fetch() empty_response()
}) })
.get("/", |_, ctx| { .get("/", |_, ctx| {
// For websocket compatibility // For websocket compatibility
@@ -195,7 +195,7 @@ pub async fn main(req: Request, env: Env, _ctx: Context) -> Result<Response> {
}); });
Response::from_websocket(pair.client) Response::from_websocket(pair.client)
}) })
.options("/*catchall", |_, _| fetch()) .options("/*catchall", |_, _| empty_response())
.run(req, env) .run(req, env)
.await .await
} }
@@ -236,7 +236,7 @@ pub fn queue_number(batch_name: &str) -> Result<u32> {
} }
} }
fn fetch() -> worker::Result<Response> { fn empty_response() -> worker::Result<Response> {
Response::empty()?.with_cors(&cors()) Response::empty()?.with_cors(&cors())
} }