From 49349365fa7d6dfdcdcf9c344bc5e7afba4a1b65 Mon Sep 17 00:00:00 2001
From: Peng-YM <1048217874pengym@gmail.com>
Date: Mon, 31 Aug 2020 13:41:39 +0800
Subject: [PATCH] Adapt status code
---
backend/.idea/workspace.xml | 66 ++++++++++++++++++-------------------
backend/sub-store.js | 10 +++---
2 files changed, 38 insertions(+), 38 deletions(-)
diff --git a/backend/.idea/workspace.xml b/backend/.idea/workspace.xml
index 25e060d..8b2bd97 100644
--- a/backend/.idea/workspace.xml
+++ b/backend/.idea/workspace.xml
@@ -81,7 +81,7 @@
-
+
@@ -101,178 +101,178 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
diff --git a/backend/sub-store.js b/backend/sub-store.js
index 3760808..9682b5b 100644
--- a/backend/sub-store.js
+++ b/backend/sub-store.js
@@ -2199,7 +2199,7 @@ function express(port = 3000) {
} else {
// no route, return 404
const res = Response();
- res.status("404").json({
+ res.status(404).json({
status: "failed",
message: "ERROR: 404 not found"
});
@@ -2250,10 +2250,10 @@ function express(port = 3000) {
const {isQX, isLoon, isSurge} = ENV();
const headers = DEFAULT_HEADERS;
const STATUS_CODE_MAP = {
- "200": "HTTP/1.1 200 OK",
- "201": "HTTP/1.1 201 Created",
- "404": "HTTP/1.1 404 Not Found",
- "500": "HTTP/1.1 500 Internal Server Error"
+ 200: "HTTP/1.1 200 OK",
+ 201: "HTTP/1.1 201 Created",
+ 404: "HTTP/1.1 404 Not Found",
+ 500: "HTTP/1.1 500 Internal Server Error"
}
return new (class {
status(code) {