pub struct ReceivedRequest {
pub method: String,
pub path: String,
pub headers: BTreeMap<String, String>,
pub body: Vec<u8>,
}Expand description
A request the FakeServer received.
§Examples
use ocre::testing::FakeServer;
let server = FakeServer::start();
let _ = ureq::post(&format!("{}/hook?x=1", server.url())).header("X-Event", "ping").send("{\"a\":1}");
let request = server.requests().pop().unwrap();
assert_eq!((request.method.as_str(), request.path.as_str()), ("POST", "/hook?x=1"));
assert_eq!(request.header("x-event"), Some("ping"));
assert_eq!(request.json::<serde_json::Value>()["a"], 1);Fields§
§method: StringGET, POST…
path: StringThe path and query string (/v1/jobs?limit=2).
headers: BTreeMap<String, String>Headers, lowercase names (the last value of a repeated header).
body: Vec<u8>The body (chunked bodies decoded).
Implementations§
Trait Implementations§
Source§impl Clone for ReceivedRequest
impl Clone for ReceivedRequest
Source§fn clone(&self) -> ReceivedRequest
fn clone(&self) -> ReceivedRequest
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ReceivedRequest
impl Debug for ReceivedRequest
impl Eq for ReceivedRequest
Source§impl PartialEq for ReceivedRequest
impl PartialEq for ReceivedRequest
Source§fn eq(&self, other: &ReceivedRequest) -> bool
fn eq(&self, other: &ReceivedRequest) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for ReceivedRequest
Auto Trait Implementations§
impl Freeze for ReceivedRequest
impl RefUnwindSafe for ReceivedRequest
impl Send for ReceivedRequest
impl Sync for ReceivedRequest
impl Unpin for ReceivedRequest
impl UnsafeUnpin for ReceivedRequest
impl UnwindSafe for ReceivedRequest
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more