Skip to content

Accept::negotiate does not handle wildcards correctly #402

Open
@jbearer

Description

@jbearer

It correctly handles * but not */* and basetype/*. For example, the spec indicates that */* should accept any media type, but the following snippet fails with No suitable Content-Type found

let mut req = Request::new(Method::Get, "http://localhost");
req.append_header("Accept", "*/*");
let mut accept = Accept::from_headers(&req).unwrap().unwrap();
accept.negotiate(&[mime::JSON]).unwrap();

Likewise, this also fails:

let mut req = Request::new(Method::Get, "http://localhost");
req.append_header("Accept", "application/*");
let mut accept = Accept::from_headers(&req).unwrap().unwrap();
accept.negotiate(&[mime::JSON]).unwrap();

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions