From 41fe16978ea506127bf43c21e977fd9581d87282 Mon Sep 17 00:00:00 2001 From: Tyler Murphy Date: Sun, 2 Jul 2023 22:15:24 -0400 Subject: add methods to routes, allow custom headers and response codes --- src/http/response.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/http/response.rs') diff --git a/src/http/response.rs b/src/http/response.rs index 850f41e..85430a4 100644 --- a/src/http/response.rs +++ b/src/http/response.rs @@ -1,8 +1,8 @@ -use super::{code::Code, header::{HeaderMap, Header}}; +use super::{header::{HeaderMap, Header}}; #[derive(Debug, Clone)] pub struct Response { - pub status: Code, + pub status: u16, pub headers: HeaderMap, pub body: Option } @@ -20,7 +20,7 @@ impl Response { headers.put(Header::new("Server", "bashttp")); return Self { - status: Code::Success, + status: 200, headers, body: None } @@ -29,7 +29,7 @@ impl Response { pub fn deserialize(&self) -> String { let mut string = String::new(); - string += &format!("HTTP/1.1 {}\n", self.status.clone() as u16); + string += &format!("HTTP/1.1 {}\n", self.status); string += &self.headers.deserialize(); if let Some(body) = &self.body { -- cgit v1.2.3-freya