diff --git a/bs_core/src/lib.rs b/bs_core/src/lib.rs index 097f4db..131acdd 100644 --- a/bs_core/src/lib.rs +++ b/bs_core/src/lib.rs @@ -34,6 +34,7 @@ async fn raw_reader(server: Data>, req: HttpRequest) -> HttpRespon RouteResolver::RawString(RawString { raw, headers }) => { let mut res = HttpResponse::Ok().body(raw.clone()); let h = res.headers_mut(); + // todo: append mime-type headers here for (k, v) in headers.iter() { h.append( HeaderName::from_bytes(k.as_bytes()).unwrap(), @@ -47,6 +48,7 @@ async fn raw_reader(server: Data>, req: HttpRequest) -> HttpRespon let named_file = NamedFile::open_async(file).await.unwrap(); let mut res = named_file.into_response(&req); let h = res.headers_mut(); + // todo: append mime-type headers here for (k, v) in h_m.iter() { h.append( HeaderName::from_bytes(k.as_bytes()).unwrap(), @@ -54,7 +56,6 @@ async fn raw_reader(server: Data>, req: HttpRequest) -> HttpRespon ); } res - // HttpResponse::NotImplemented().body("n") } RouteResolver::DirPath(_) => HttpResponse::NotImplemented().body("n"), } diff --git a/examples/one-file/site.yaml b/examples/one-file/site.yaml index 42242fa..d5ba646 100644 --- a/examples/one-file/site.yaml +++ b/examples/one-file/site.yaml @@ -1,7 +1,7 @@ servers: server_a: routes: - - path: /testing.html + - path: / raw: | @@ -10,23 +10,32 @@ servers: Document + - + + - path: /js.js + raw: | + import a from "b.js" + - path: /b.js + raw: | + console.log(import.meta) - path: /iframe.html headers: X-Frame-Options: SAMEORIGIN - Content-Security-Policy: frame-ancestors https://example.com + Content-Security-Policy: frame-ancestors 'self' raw: |

🙈 Hello from iframe.html

-# - path: / -# dir: ./ - - path: /haha.css - headers: - shane: "kittens" - sally: "other" - file: ./style.css + # - path: / + # dir: ./ + - path: /styles.css + raw: | + @import url("other.css"); + - path: /other.css + raw: | + body { background: red } # - path: / # dir: ./