worker version is latest, http feature

worker version is latest, http feature is enabled, as I motioned before that url() method is return url::Url type, why compiler lookup worker::Url I'm confused.
7 Replies
Unknown User
Unknown User•3mo ago
Message Not Public
Sign In & Join Server To View
rudo
rudoOP•3mo ago
Unknown User
Unknown User•3mo ago
Message Not Public
Sign In & Join Server To View
rudo
rudoOP•3mo ago
ok, here is the lib.rs
use worker::*;

#[event(fetch)]
async fn fetch(
req: Request,
env: Env,
ctx: Context,
) -> Result<Response> {
console_error_panic_hook::set_once();
let router = Router::new();

router
.get_async("/", |req, ctx| async move {
use url::Url;
let key = req.url()?;
return if let Some(key) = key.param("num") {
Response::ok(key)
} else {
Response::error("Bad Request", 400)
}

})
.run(req, env)
.await
}
use worker::*;

#[event(fetch)]
async fn fetch(
req: Request,
env: Env,
ctx: Context,
) -> Result<Response> {
console_error_panic_hook::set_once();
let router = Router::new();

router
.get_async("/", |req, ctx| async move {
use url::Url;
let key = req.url()?;
return if let Some(key) = key.param("num") {
Response::ok(key)
} else {
Response::error("Bad Request", 400)
}

})
.run(req, env)
.await
}
Unknown User
Unknown User•3mo ago
Message Not Public
Sign In & Join Server To View
rudo
rudoOP•3mo ago
Yeah, I use query_pairs in the end. Thanks a lot 🙂
Unknown User
Unknown User•3mo ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server