http_sh/
lib.rs

1use std::collections::HashMap;
2
3use serde::{Deserialize, Serialize};
4
5#[derive(Serialize, Deserialize, Debug)]
6pub struct Request {
7    pub stamp: scru128::Scru128Id,
8    pub message: String,
9    pub proto: String,
10    #[serde(with = "http_serde::method")]
11    pub method: http::method::Method,
12    #[serde(skip_serializing_if = "Option::is_none")]
13    pub authority: Option<String>,
14    #[serde(skip_serializing_if = "Option::is_none")]
15    pub remote_ip: Option<std::net::IpAddr>,
16    #[serde(skip_serializing_if = "Option::is_none")]
17    pub remote_port: Option<u16>,
18    #[serde(with = "http_serde::header_map")]
19    pub headers: http::header::HeaderMap,
20    #[serde(with = "http_serde::uri")]
21    pub uri: http::Uri,
22    pub path: String,
23    pub query: HashMap<String, String>,
24    #[serde(skip_serializing_if = "Option::is_none")]
25    pub response: Option<Response>,
26}
27
28#[derive(Default, Debug, Serialize, Deserialize, Clone)]
29pub struct Response {
30    #[serde(skip_serializing_if = "Option::is_none")]
31    pub status: Option<u16>,
32    #[serde(skip_serializing_if = "Option::is_none")]
33    pub headers: Option<std::collections::HashMap<String, String>>,
34}