pub struct UreqClient { /* private fields */ }Expand description
Production HTTP client backed by ureq::Agent.
Attaches User-Agent to every request. GitHub Authorization header
is only sent to GitHub domains (api.github.com,
raw.githubusercontent.com) — never to third-party registries.
Implementations§
Source§impl UreqClient
impl UreqClient
Trait Implementations§
Source§impl Default for UreqClient
impl Default for UreqClient
Source§impl HttpClient for UreqClient
impl HttpClient for UreqClient
Source§fn get_bytes(&self, url: &str) -> Result<Vec<u8>, SkillfileError>
fn get_bytes(&self, url: &str) -> Result<Vec<u8>, SkillfileError>
Returns
Err(SkillfileError::Network) on HTTP errors (including 404).Source§fn get_json(&self, url: &str) -> Result<Option<String>, SkillfileError>
fn get_json(&self, url: &str) -> Result<Option<String>, SkillfileError>
GET a URL with
Accept: application/vnd.github.v3+json header. Read moreSource§fn post_json(&self, url: &str, body: &str) -> Result<Vec<u8>, SkillfileError>
fn post_json(&self, url: &str, body: &str) -> Result<Vec<u8>, SkillfileError>
POST a JSON body to a URL and return the response body as bytes. Read more
Source§fn post_json_with_bearer(
&self,
req: &BearerPost<'_>,
) -> Result<Vec<u8>, SkillfileError>
fn post_json_with_bearer( &self, req: &BearerPost<'_>, ) -> Result<Vec<u8>, SkillfileError>
POST with a custom
Authorization: Bearer header (for non-GitHub APIs). Read moreAuto Trait Implementations§
impl Freeze for UreqClient
impl !RefUnwindSafe for UreqClient
impl Send for UreqClient
impl Sync for UreqClient
impl Unpin for UreqClient
impl UnsafeUnpin for UreqClient
impl !UnwindSafe for UreqClient
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