Skip to content

Commit 904da14

Browse files
committed
remov _stream_test endpoint (moved to examples)
1 parent 0c7d0b5 commit 904da14

File tree

1 file changed

+2
-19
lines changed

1 file changed

+2
-19
lines changed

src/main.rs

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,7 @@ fn is_proxy(config: &Config, req: HttpRequest) -> Option<(String, HttpRequest)>
4545

4646
fn serve_file(path: &String) -> Option<Vec<u8>> {
4747
let r = fs::read(path);
48-
if r.is_ok() {
49-
Some(r.unwrap())
50-
} else {
51-
None
52-
}
48+
if r.is_ok() { Some(r.unwrap()) } else { None }
5349
}
5450

5551
fn main() {
@@ -124,19 +120,6 @@ fn main() {
124120
// SERVER CORE
125121
// for each request
126122
logger.msg(format!("Request {} {}", req.method.to_str(), req.path));
127-
if req.path == "/_stream_test".to_string() {
128-
let times = req.args.get("t");
129-
let times = times.unwrap_or(&"3".to_string()).to_string();
130-
let times: usize = times.parse().unwrap_or(3);
131-
return StreamedResponse::new(move |sender| {
132-
for i in 0..times {
133-
let data = format!("{i}-abcd\n").as_bytes().to_vec();
134-
let _ = sender.send(data.clone());
135-
thread::sleep(Duration::from_secs(1));
136-
}
137-
});
138-
}
139-
140123
let is_proxy = is_proxy(&config, req.clone());
141124

142125
if proxy_only || is_proxy.is_some() {
@@ -152,7 +135,7 @@ fn main() {
152135
);
153136
}
154137
}
155-
138+
156139
let mut full_path = format!("{}{}", config.root, req.path.clone());
157140
if Path::new(full_path.as_str()).is_dir() {
158141
let separator = if full_path.ends_with('/') { "" } else { "/" };

0 commit comments

Comments
 (0)