all repos — litestore @ 2ff13f90943f601a8053fc320a7c4617ff981e0a

A minimalist nosql document store.

Additional fixes for #48.
h3rald h3rald@h3rald.com
Sun, 13 Jan 2019 11:48:29 +0100
commit

2ff13f90943f601a8053fc320a7c4617ff981e0a

parent

4fe1eb74b1fa9da69b53c76571b0caa0751a8509

2 files changed, 5 insertions(+), 9 deletions(-)

jump to
M src/litestorepkg/lib/api_v4.nimsrc/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.nimsrc/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 }