Additional fixes for #48.
h3rald h3rald@h3rald.com
Sun, 13 Jan 2019 11:48:29 +0100
2 files changed,
5 insertions(+),
9 deletions(-)
M
src/litestorepkg/lib/api_v4.nim
→
src/litestorepkg/lib/api_v4.nim
@@ -578,16 +578,15 @@
proc options*(req: LSRequest, LS: LiteStore, resource: string, id = ""): LSResponse = case resource: of "info": + result.headers = newHttpHeaders(TAB_HEADERS) + setOrigin(LS, req, result.headers) + result.headers["Allow"] = "GET,OPTIONS" + result.headers["Access-Control-Allow-Methods"] = "GET, OPTIONS" if id != "": return resError(Http404, "Info '$1' not found." % id) else: result.code = Http200 result.content = "" - result.headers = newHttpHeaders(TAB_HEADERS) - setOrigin(LS, req, result.headers) - result.headers["Allow"] = "GET,OPTIONS" - result.headers["Access-Control-Allow-Methods"] = "GET, OPTIONS" - result.headers["Access-Control-Allow-Headers"] = "Content-Type, Authorization" of "dir": result.code = Http200 result.content = ""@@ -595,7 +594,6 @@ result.headers = newHttpHeaders(TAB_HEADERS)
setOrigin(LS, req, result.headers) result.headers["Allow"] = "GET,OPTIONS" result.headers["Access-Control-Allow-Methods"] = "GET, OPTIONS" - result.headers["Access-Control-Allow-Headers"] = "Content-Type, Authorization" of "tags": result.code = Http200 result.content = ""@@ -603,7 +601,6 @@ result.headers = newHttpHeaders(TAB_HEADERS)
setOrigin(LS, req, result.headers) result.headers["Allow"] = "GET,OPTIONS" result.headers["Access-Control-Allow-Methods"] = "GET, OPTIONS" - result.headers["Access-Control-Allow-Headers"] = "Content-Type, Authorization" of "docs": var folder: string if id.isFolder:@@ -648,7 +645,6 @@ result.headers = newHttpHeaders(TAB_HEADERS)
setOrigin(LS, req, result.headers) result.headers["Allow"] = "HEAD,GET,OPTIONS,POST" result.headers["Access-Control-Allow-Methods"] = "HEAD, GET, OPTIONS, POST" - result.headers["Access-Control-Allow-Headers"] = "Content-Type, Authorization" else: discard # never happens really.
M
src/litestorepkg/lib/types.nim
→
src/litestorepkg/lib/types.nim
@@ -109,7 +109,7 @@ LS.appname = appname
TAB_HEADERS = { "Access-Control-Allow-Origin": "*", - "Access-Control-Allow-Headers": "Content-Type", + "Access-Control-Allow-Headers": "Authorization, Content-Type", "Server": LS.appname & "/" & LS.appversion }