all repos — litestore @ b7cbccb95756d2c8010a3e76f5143d1a1c6d84ec

A minimalist nosql document store.

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

b7cbccb95756d2c8010a3e76f5143d1a1c6d84ec

parent

c8f651f3b50e01c85da0b3379c564907bfd9c1a9

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: