pub struct ExpectedRequest<'a> {
pub method: &'a str,
pub url: &'a str,
pub body: Option<&'a [u8]>,
}Expand description
The request a signed header is bound to: method, URL and optional body.
The verifier compares the signed event against these values, so the URL
must be the one the server trusts (for example rebuilt from a validated
Host and the request path), never a value copied from the token. body
is None for a request without a body and Some (possibly empty) for a
request with one. The signer uses the same type to say what it signs.
§Examples
use stratum_node_core::ExpectedRequest;
let get = ExpectedRequest::new("GET", "http://127.0.0.1:7070/api/v1/config", None);
let post = ExpectedRequest { method: "POST", url: get.url, body: Some(b"{}") };
assert_eq!(post.url, get.url);Fields§
§method: &'a strThe HTTP method token, compared byte for byte with the method tag.
HTTP method names are case-sensitive (RFC 9110, section 9.1), so
POST and post are different methods. Pass the method exactly as
the request line carried it.
url: &'a strThe absolute URL, compared byte for byte with the u tag.
body: Option<&'a [u8]>The request body, if the request has one.
Implementations§
Trait Implementations§
Source§impl<'a> Clone for ExpectedRequest<'a>
impl<'a> Clone for ExpectedRequest<'a>
impl<'a> Copy for ExpectedRequest<'a>
Source§impl<'a> Debug for ExpectedRequest<'a>
impl<'a> Debug for ExpectedRequest<'a>
impl<'a> Eq for ExpectedRequest<'a>
Source§impl<'a> PartialEq for ExpectedRequest<'a>
impl<'a> PartialEq for ExpectedRequest<'a>
impl<'a> StructuralPartialEq for ExpectedRequest<'a>
Auto Trait Implementations§
impl<'a> Forget for ExpectedRequest<'a>
impl<'a> Freeze for ExpectedRequest<'a>
impl<'a> Move for ExpectedRequest<'a>
impl<'a> RefUnwindSafe for ExpectedRequest<'a>
impl<'a> Send for ExpectedRequest<'a>
impl<'a> Sync for ExpectedRequest<'a>
impl<'a> Unpin for ExpectedRequest<'a>
impl<'a> UnsafeUnpin for ExpectedRequest<'a>
impl<'a> UnwindSafe for ExpectedRequest<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more