diff --git a/jester/request.nim b/jester/request.nim index 7c6a1a9..ebd23bf 100644 --- a/jester/request.nim +++ b/jester/request.nim @@ -55,6 +55,19 @@ proc path*(req: Request): string = let u = req.req.url return u.path +proc query*(req: Request): string = + ## Query string of request + when useHttpBeast: + let p = req.req.path.get("") + let queryStart = p.find('?') + if likely(queryStart != -1): + return p[queryStart .. ^1] + else: + return "" + else: + let u = req.req.url + return u.query + proc reqMethod*(req: Request): HttpMethod = ## Request method, eg. HttpGet, HttpPost when useHttpBeast: diff --git a/readme.markdown b/readme.markdown index 8d10a9b..28d226d 100644 --- a/readme.markdown +++ b/readme.markdown @@ -167,6 +167,7 @@ Request* = ref object pathInfo*: string ## This is ``.path`` without ``.appName``. secure*: bool path*: string ## Path of request. + query*: string ## Query string of request. cookies*: StringTableRef ## Cookies from the browser. ip*: string ## IP address of the requesting client. reqMeth*: TReqMeth ## Request method, eg. HttpGet, HttpPost