kode_bridge/types.rs
1use serde::{Deserialize, Serialize};
2use serde_json::Value;
3use std::convert::From;
4
5use crate::errors::AnyError;
6
7#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8pub struct Response {
9 pub status: u16,
10 pub headers: serde_json::Value,
11 pub body: String,
12}
13
14impl Response {
15 pub fn json(&self) -> Result<Value, AnyError> {
16 serde_json::from_str(&self.body).map_err(AnyError::from)
17 }
18}