all repos — litestore @ 99b86034b92e60b5930abb4379fe1bc4e35f4dd4

A minimalist nosql document store.

Fixed errors & warnings; compiling with Nim v0.15.2.
h3rald h3rald@h3rald.com
Fri, 02 Dec 2016 21:48:06 +0100
commit

99b86034b92e60b5930abb4379fe1bc4e35f4dd4

parent

89bc50b400a10f9af41add180bddca2adc482c0a

M lib/api_v1.nimlib/api_v1.nim

@@ -396,7 +396,7 @@ let path = LS.directory / id

var reqMethod = req.reqMethod if req.headers.hasKey("X-HTTP-Method-Override"): reqMethod = req.headers["X-HTTP-Method-Override"] - case reqMethod.toUpper: + case reqMethod.toUpperAscii: of "OPTIONS": return validate(req, LS, "dir", id, options) of "GET":

@@ -421,7 +421,7 @@ proc route*(req: Request, LS: LiteStore, resource = "docs", id = ""): Response =

var reqMethod = req.reqMethod if req.headers.hasKey("X-HTTP-Method-Override"): reqMethod = req.headers["X-HTTP-Method-Override"] - case reqMethod.toUpper: + case reqMethod.toUpperAscii: of "POST": if LS.readonly: return resError(Http405, "Method not allowed: $1" % req.reqMethod)
M lib/api_v2.nimlib/api_v2.nim

@@ -435,7 +435,7 @@ let path = LS.directory / id

var reqMethod = req.reqMethod if req.headers.hasKey("X-HTTP-Method-Override"): reqMethod = req.headers["X-HTTP-Method-Override"] - case reqMethod.toUpper: + case reqMethod.toUpperAscii: of "OPTIONS": return validate(req, LS, "dir", id, options) of "GET":

@@ -460,7 +460,7 @@ proc route*(req: Request, LS: LiteStore, resource = "docs", id = ""): Response =

var reqMethod = req.reqMethod if req.headers.hasKey("X-HTTP-Method-Override"): reqMethod = req.headers["X-HTTP-Method-Override"] - case reqMethod.toUpper: + case reqMethod.toUpperAscii: of "POST": if LS.readonly: return resError(Http405, "Method not allowed: $1" % req.reqMethod)
M lib/cli.nimlib/cli.nim

@@ -8,7 +8,7 @@ config,

types, utils -const favicon = "admin/favicon.ico".slurp +const favicon = "../admin/favicon.ico".slurp var operation = opRun
M lib/config.nimlib/config.nim

@@ -4,7 +4,7 @@ streams,

strutils const - cfgfile = "litestore.nimble".slurp + cfgfile = "../litestore.nimble".slurp var file* = "data.db"

@@ -16,7 +16,7 @@ f = newStringStream(cfgfile)

if f != nil: var p: CfgParser - open(p, f, "litestore.nimble") + open(p, f, "../litestore.nimble") while true: var e = next(p) case e.kind
M lib/contenttypes.nimlib/contenttypes.nim

@@ -3,7 +3,7 @@

proc loadContentTypes(): StringTableRef = result = newStringTable(modeCaseInsensitive) - const raw_json = "lib/contenttypes.json".slurp + const raw_json = "../lib/contenttypes.json".slurp let json = raw_json.parseJson for item in json.items: for pair in item.pairs:
M lib/server.nimlib/server.nim

@@ -59,7 +59,7 @@ return resError(Http400, "Bad request - Invalid resource: $1" % info.resource)

proc process(req: Request, LS: LiteStore): Response {.gcsafe.}= var matches = @["", "", ""] - template route(req, peg: expr, op: stmt): stmt {.immediate.}= + template route(req: Request, peg: Peg, op: untyped): untyped = if req.url.path.find(peg, matches) != -1: op try:
M lib/x_asynchttpserver.nimlib/x_asynchttpserver.nim

@@ -197,7 +197,7 @@ var nMethod = reqMethod.normalize

if nMethod == "post" or nMethod == "put" or nMethod == "patch": # Check for Expect header if request.headers.hasKey("Expect"): - if request.headers["Expect"].toLower == "100-continue": + if request.headers["Expect"].toLowerAscii == "100-continue": await client.sendStatus("100 Continue") else: await client.sendStatus("417 Expectation Failed")