Skip to content

Commit

Permalink
Update worker/src/lib.rs
Browse files Browse the repository at this point in the history
Co-authored-by: Augusto César <[email protected]>
  • Loading branch information
ostenbom and augustoccesar authored Feb 23, 2024
1 parent 368fafb commit 6608c6f
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions worker/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,11 @@ pub async fn main(req: Request, env: Env, _ctx: worker::Context) -> Result<Respo
}
}

if req.method() == Method::Post && req.path() == "/linkup" {
return linkup_session_handler(req, &sessions).await;
return match (req.method(), req.path().as_str()) {
(Method::Post, "/linkup") => linkup_session_handler(req, &sessions).await,
(Method::Post, "/preview") => linkup_preview_handler(req, &sessions).await,
_ => linkup_request_handler(req, &sessions).await,
}

if req.method() == Method::Post && req.path() == "/preview" {
return linkup_preview_handler(req, &sessions).await;
}

linkup_request_handler(req, &sessions).await
}

async fn linkup_session_handler<'a, S: StringStore>(
Expand Down

0 comments on commit 6608c6f

Please sign in to comment.