Http responses contain body
This commit is contained in:
17
src/websocket/mod.rs
Normal file
17
src/websocket/mod.rs
Normal file
@ -0,0 +1,17 @@
|
||||
use crate::http;
|
||||
|
||||
pub fn connection_handler(client: &mut http::HttpStream, req: &http::Request) {
|
||||
client.server_keep_alive = false;
|
||||
let mut res = http::Response::new();
|
||||
|
||||
if let http::Method::GET = req.method {
|
||||
res.status(501);
|
||||
} else {
|
||||
res.status(405);
|
||||
res.add_header("Allow", "GET");
|
||||
res.send(&mut client.stream);
|
||||
return;
|
||||
}
|
||||
|
||||
res.send(&mut client.stream);
|
||||
}
|
Reference in New Issue
Block a user