« get me outta code hell

scratchrlol - Simple HTML-based Scratch client
summary refs log tree commit diff
path: root/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'index.js')
-rwxr-xr-xindex.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/index.js b/index.js
index 3ed4996..53426f5 100755
--- a/index.js
+++ b/index.js
@@ -367,6 +367,7 @@ const handleRequest = async (request, response) => {
 
     const project = await getProject(projectID, cookie.token)
     if (project.code === 'NotFound') {
+      response.statusCode = 404
       return page(request, response, fixWS`
         404. Sorry, that project either doesn't exist or isn't shared.
       `)
@@ -425,6 +426,7 @@ const handleRequest = async (request, response) => {
     const user = await getUser(username)
 
     if (user.code === 'NotFound') {
+      response.statusCode = 404
       return page(request, response, fixWS`
         404. Sorry, that user doesn't exist.
       `)
@@ -478,6 +480,7 @@ const handleRequest = async (request, response) => {
     `)
   }
 
+  response.statusCode = 404
   return page(request, response, fixWS`
     404. Sorry, I'm not sure where you are right now.
   `)
@@ -486,6 +489,7 @@ const handleRequest = async (request, response) => {
 const server = http.createServer((request, response) => {
   handleRequest(request, response).catch(error => {
     console.error(error)
+    response.statusCode = 500
     return page(request, response, fixWS`
       500. Sorry, there was an internal server error.
     `)