pub struct Endpoint {
pub url: String,
pub method: String,
pub query: Query,
pub headers: Headers,
pub variables: Variables,
pub path: PathBuf,
pub body: Option<String>,
}
Fields§
§url: String
§method: String
HTTP Request method
query: Query
Query params.
headers: Headers
List of (key, value) pairs.
variables: Variables
Variable values applied from a Env
path: PathBuf
§body: Option<String>
Implementations§
Source§impl Endpoint
impl Endpoint
pub fn new(path: PathBuf) -> Self
pub fn name_to_dir(name: &str) -> String
pub fn from_dir(dir: &Path) -> Result<Self, Box<dyn Error>>
pub fn update(&mut self, src: &mut EndpointPatch)
pub fn to_toml(&self) -> Result<String, Error>
pub fn load_body(&mut self) -> Option<&String>
pub fn body(&mut self) -> Option<&String>
pub fn set_handle(&mut self, ctx: &Ctx, handle: &EndpointHandle)
pub fn parent(&self) -> Option<Self>
Sourcepub fn resolve_url(&mut self)
pub fn resolve_url(&mut self)
Inherits parent URL when it starts with “**”.
pub fn apply_env(&mut self, env: &Env)
pub fn full_url(&self) -> Result<Uri, InvalidUri>
Sourcepub fn into_request(self) -> Result<Request<Body>, Error>
pub fn into_request(self) -> Result<Request<Body>, Error>
Returns the a Request
consuming struct.
pub fn colored_method(&self) -> ColoredString
Sourcepub fn query_string(&self) -> String
pub fn query_string(&self) -> String
Return a query string based off of defined queries.
§Example
A hash map composed of:
[query]
v = 9000
fields = "lorem,ipsum"
would return: v=9000&fields=lorem,ipsum
pub fn write(&mut self)
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Endpoint
impl<'de> Deserialize<'de> for Endpoint
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<&mut EndpointPatch> for Endpoint
impl From<&mut EndpointPatch> for Endpoint
Source§fn from(value: &mut EndpointPatch) -> Self
fn from(value: &mut EndpointPatch) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for Endpoint
impl RefUnwindSafe for Endpoint
impl Send for Endpoint
impl Sync for Endpoint
impl Unpin for Endpoint
impl UnwindSafe for Endpoint
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