Skip to content

[BUG] url resolve error #766

@lingting

Description

@lingting

Is there an existing issue for this?

  • I have searched the existing issues

What version of workers-rs are you using?

0.6.0

What version of wrangler are you using?

^4.23.0

Describe the bug

request: curl http://127.0.0.1:8787/sing-box?remote=https://xxcc/api/v1/client/subscribe?token=xxx

Expected: Deny access!
Actual: INTERNAL SERVER ERROR

Parsed normally when using js, but abnormal when using rust

lib.rs:

use std::collections::HashMap;
use worker::*;

#[event(fetch)]
async fn main(req: Request, env: Env, ctx: Context) -> Result<Response> {
    let q: HashMap<String, Vec<String>> = req.query()?;
    return Ok(Response::builder().with_status(403).ok("Deny access!")?);
}

log:

invalid type: string "https://xxcc/api/v1/client/subscribe?token=xxx", expected a sequence

Steps To Reproduce

  1. create project: cargo generate cloudflare/workers-rs
  2. edit lib.rs to
use std::collections::HashMap;
use worker::*;

#[event(fetch)]
async fn main(req: Request, env: Env, ctx: Context) -> Result<Response> {
    let q: HashMap<String, Vec<String>> = req.query()?;
    return Ok(Response::builder().with_status(403).ok("Deny access!")?);
}
  1. exec: curl http://127.0.0.1:8787/sing-box?remote=https://xxcc/api/v1/client/subscribe?token=xxx

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions