Skip to content
This repository was archived by the owner on Jun 7, 2024. It is now read-only.

Commit 4bcc958

Browse files
committed
Bump version to 0.2.1
1 parent ebea612 commit 4bcc958

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "wasi-http-client"
33
description = "HTTP client library for WASI"
44
readme = "README.md"
5-
version = "0.2.0"
5+
version = "0.2.1"
66
edition = "2021"
77
authors = ["Xinzhao Xu"]
88
categories = ["wasm"]

src/response.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,23 @@ impl Response {
7575
/// # Optional
7676
///
7777
/// This requires the `json` feature enabled.
78+
///
79+
/// ```
80+
/// # use anyhow::Result;
81+
/// # use serde::Deserialize;
82+
/// # use wasi_http_client::Client;
83+
/// # fn run() -> Result<()> {
84+
/// #[derive(Deserialize)]
85+
/// struct Data {
86+
/// origin: String,
87+
/// url: String,
88+
/// }
89+
///
90+
/// let resp = Client::new().get("https://httpbin.org/get").send()?;
91+
/// let json_data = resp.json::<Data>()?;
92+
/// # Ok(())
93+
/// # }
94+
/// ```
7895
#[cfg(feature = "json")]
7996
#[cfg_attr(docsrs, doc(cfg(feature = "json")))]
8097
pub fn json<T: DeserializeOwned>(self) -> Result<T> {

0 commit comments

Comments
 (0)