all repos — litestore @ 71b1ef3a8d160087c5190ef22f9a27408f99044e

A minimalist nosql document store.

Fixed problems with setOrigin.
h3rald h3rald@h3rald.com
Sat, 16 Feb 2019 20:52:16 +0000
commit

71b1ef3a8d160087c5190ef22f9a27408f99044e

parent

5e83599289cc10cb8b61d29756006f902865fa0e

3 files changed, 5 insertions(+), 1 deletions(-)

jump to
M src/litestorepkg/lib/api_v4.nimsrc/litestorepkg/lib/api_v4.nim

@@ -478,6 +478,7 @@ if not folder.isFolder:

return resError(Http400, "Invalid folder specified when creating document: $1" % folder) try: var doc = LS.store.createDocument(folder, body, ct) + echo doc if doc != "": result.headers = ctJsonHeader() setOrigin(LS, req, result.headers)

@@ -486,6 +487,7 @@ result.code = Http201

else: result = resError(Http500, "Unable to create document.") except: + eWarn() result = resError(Http500, "Unable to create document.") proc putDocument*(LS: LiteStore, id: string, body: string, ct: string, req: LSRequest): LSResponse =
M src/litestorepkg/lib/core.nimsrc/litestorepkg/lib/core.nim

@@ -99,12 +99,14 @@ if LS_TRANSACTION:

LOG.debug("Committing transaction") LS_TRANSACTION = false store.db.exec("COMMIT".sql) + LOG.debug("Committed.") proc rollback(store: Datastore) = if LS_TRANSACTION: LOG.debug("Rolling back transaction") LS_TRANSACTION = false store.db.exec("ROLLBACK".sql) + LOG.debug("Rolled back.") # Manage Tags
M src/litestorepkg/lib/utils.nimsrc/litestorepkg/lib/utils.nim

@@ -27,7 +27,7 @@ elif req.headers.hasKey("origin"):

let parts = req.headers["origin"].split("://") protocol = parts[0] let server = parts[1].split(":") - if (parts.len >= 2): + if (server.len >= 2): host = server[0] port = server[1] else: