Skip to content

Unable to use GET macro and prefix route with '@' #2950

@brianjd

Description

@brianjd

Rocket Version

0.5.1

Operating System

Linux

Rust Toolchain Version

rustc 1.88

What happened?

When trying to define a route path like this using the macro, prefixed with @, the attribute passed has this error:

#[get("/@<username>")]
fn user(username: &str) -> String {
the trait bound `&str: FromRequest<'_>` is not satisfied
the following other types implement trait `FromRequest<'r>`:
  &'r ContentType
  &'r Limits
  &'r Route
  &'r rocket::Config
  &'r rocket::State<T>
  &'r rocket::http::Accept
  &'r rocket::http::CookieJar<'r>
  &'r rocket::http::uri::Host<'r>

As per HTTP spec you should be able to use @, emojis, etc in URL.

Test Case

===

Log Output

===

Additional Context

No response

System Checks

  • My bug report relates to functionality.
  • I have tested against the latest Rocket release or a recent git commit.
  • I have tested against the latest stable rustc toolchain.
  • I was unable to find this issue previously reported.

Metadata

Metadata

Assignees

No one assigned

    Labels

    triageA bug report being investigated

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions