Struct ::http::Response

Overview

A Response to a submitted [Request].

Methods

async fn text(self) -> Result

Get the response as text.

let client = http::Client::new();

let response = client.get("http://example.com")
   .body_bytes(b"Hello World")
   .send()
   .await?;

let response = response.text().await?;
async fn json(self) -> Result

Get the response as a Rune value decoded from JSON.

async fn bytes(self) -> Result

Get the response as bytes.

let client = http::Client::new();

let response = client.get("http://example.com")
   .send()
   .await?;

let response = response.bytes().await?;

Get the status code of the response.