Skip to main content

post_json

Function post_json 

Source
pub async fn post_json<T: DeserializeOwned>(
    client: &Client,
    url: &str,
    body: &(impl Serialize + ?Sized),
    api_key: Option<&str>,
) -> Result<T>
Expand description

POST a typed request body and decode a typed response.

The bridge always knows which shape it expects, so the response is decoded into a struct instead of being poked at as a generic document; a server that answers with something else fails here rather than later.