about summary refs log tree commit diff
path: root/web/bubblegum/examples
diff options
context:
space:
mode:
authorsterni <sternenseemann@systemli.org>2021-04-04T23·58+0200
committersterni <sternenseemann@systemli.org>2021-04-05T10·54+0000
commit386afdc794eefd5bcbc47a3fd7b898a07f69f978 (patch)
tree7fdb834139cf48794b68ef481220ecf479bd1d7b /web/bubblegum/examples
parent1c0f89f4cadba4957e95fc80b25b1b8b6dd1a3b3 (diff)
feat(web/bubblegum): allow passing status as an int r/2439
The whole pass the name of the status as a string thing was mostly born
out of an overeager use of yants. It is still very neat especially for
common cases like "OK", so we'll keep it, but also allow passing the
integer variant of the status as well which probably feels more natural
for a lot of people, especially over getting the casing right for
"I'm a teapot".

Change-Id: I3f012a291447ef385efdd28132292a8b331998c0
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2850
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
Diffstat (limited to 'web/bubblegum/examples')
-rw-r--r--web/bubblegum/examples/blog.nix8
1 files changed, 4 insertions, 4 deletions
diff --git a/web/bubblegum/examples/blog.nix b/web/bubblegum/examples/blog.nix
index f79ab0627e88..213fbb7d19ba 100644
--- a/web/bubblegum/examples/blog.nix
+++ b/web/bubblegum/examples/blog.nix
@@ -108,24 +108,24 @@ let
     if pathInfo == "/"
     then {
       title = "blog";
-      status = "OK";
+      status = 200;
       inner = index posts;
     }
     else if !(validatePathInfo pathInfo)
     then {
       title = "Bad Request";
-      status = "Bad Request";
+      status = 400;
       inner = "No slashes in post names 😡";
     }
     # CGI should already url.decode for us
     else if builtins.pathExists (blogdir + "/" + pathInfo)
     then rec {
       title = parseTitle pathInfo;
-      status = "OK";
+      status = 200;
       inner = post title pathInfo;
     } else {
       title = "Not Found";
-      status = "Not Found";
+      status = 404;
       inner = "<h1>404 — not found</h1>";
     };
 in