summaryrefslogtreecommitdiffstats
path: root/src/http
diff options
context:
space:
mode:
Diffstat (limited to 'src/http')
-rw-r--r--src/http/mod.rs6
-rw-r--r--src/http/render.rs3
-rw-r--r--src/http/routes/mod.rs6
3 files changed, 10 insertions, 5 deletions
diff --git a/src/http/mod.rs b/src/http/mod.rs
index 5c34466..a77869e 100644
--- a/src/http/mod.rs
+++ b/src/http/mod.rs
@@ -48,7 +48,8 @@ pub(crate) struct Res {
}
impl Res {
- pub fn html(status: u16, body: String) -> Self {
+ /// `pub(crate)`, not `pub`: the census counted it as test-only because the word appears in `tests/http.rs`, but only inside a string — a route path, a content type, the word "redirect" in an assertion message. Nothing in the test tier calls it.
+ pub(crate) fn html(status: u16, body: String) -> Self {
Self { status, content_type: "text/html; charset=utf-8".into(), body: body.into_bytes(), headers: Vec::new(), stream: None, stream_len: None }
}
pub fn text(status: u16, body: String) -> Self {
@@ -64,7 +65,8 @@ impl Res {
stream_len: known_len,
}
}
- pub fn redirect(location: &str) -> Self {
+ /// `pub(crate)`, not `pub`: the census counted it as test-only because the word appears in `tests/http.rs`, but only inside a string — a route path, a content type, the word "redirect" in an assertion message. Nothing in the test tier calls it.
+ pub(crate) fn redirect(location: &str) -> Self {
Self {
status: 303,
content_type: "text/plain".into(),
diff --git a/src/http/render.rs b/src/http/render.rs
index fdf5676..470125d 100644
--- a/src/http/render.rs
+++ b/src/http/render.rs
@@ -179,7 +179,8 @@ pub(crate) struct SubRow {
#[derive(Template)]
#[template(path = "attention.html")]
-pub struct Attention {
+/// `pub(crate)`, not `pub`: the census counted it as test-only because the word appears in `tests/http.rs`, but only inside a string — a route path, a content type, the word "redirect" in an assertion message. Nothing in the test tier calls it.
+pub(crate) struct Attention {
pub page: Page,
pub empty: bool,
pub notices: Vec<NoticeRow>,
diff --git a/src/http/routes/mod.rs b/src/http/routes/mod.rs
index 7495524..1ef7fde 100644
--- a/src/http/routes/mod.rs
+++ b/src/http/routes/mod.rs
@@ -33,7 +33,8 @@ pub(crate) fn login_form(state: &State, req: &Req) -> Res {
page_to_res(Login { page, error: String::new() }, 200)
}
-pub fn logout(req: &Req) -> Res {
+/// `pub(crate)`, not `pub`: the census counted it as test-only because the word appears in `tests/http.rs`, but only inside a string — a route path, a content type, the word "redirect" in an assertion message. Nothing in the test tier calls it.
+pub(crate) fn logout(req: &Req) -> Res {
if let Some(sid) = req.cookie("sid") {
auth::drop_session(&sid);
}
@@ -62,7 +63,8 @@ pub fn login(state: &State, req: &Req) -> Res {
}
}
-pub fn route(state: &State, req: &Req, seg: &[&str]) -> Res {
+/// `pub(crate)`, not `pub`: the census counted it as test-only because the word appears in `tests/http.rs`, but only inside a string — a route path, a content type, the word "redirect" in an assertion message. Nothing in the test tier calls it.
+pub(crate) fn route(state: &State, req: &Req, seg: &[&str]) -> Res {
match (req.method.as_str(), seg) {
("GET", []) => dashboard(state, req),
("GET", ["reviews"]) => reviews(state, req),