You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
error[E0277]: the type `[rocket::http::Cookie<'_>]` cannot be indexed by `&str`
--> src/tests.rs:44:35
|
44 | assert_eq!(response.cookies().get("X-Auth-Token").is_none(), true);
| ^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `std::slice::SliceIndex<[rocket::http::Cookie<'_>]>` is not implemented for `&str`
rust: 1.35.0-nightly (7c19e1eed 2019-03-12)
rocket: 0.4.0
I'm trying to advance my tests before I implement, following a standard TDD pattern and I'm running in to a problem and it's driving me batty.
Also: this is my first week working with rust so I know I'm doing something wrong, I just don't know what it is.
I'm trying to simply test for the presence of a cookie; at this stage I don't care that there's anything in the cookie.
My test:
However, rustc (via cargo test) complains:
Now based on what I've read here: https://api.rocket.rs/v0.4/rocket/local/struct.LocalResponse.html#method.cookies and here: https://api.rocket.rs/rocket/http/enum.Cookies.html - I think I should be able to pass an &str to retrieve a specific cookie and just verify it exists (or doesn't). However the help message is clearly telling me that it .get() expects a usize.
So what am I missing here? I don't need a straight answer, if you can just point me to the right place to RTFM, that's good enough.
The text was updated successfully, but these errors were encountered: