Skip to content

Commit e456548

Browse files
#164 added automatic URL decoding (#166)
* #164 added URL decoding to path and query params * #164 updated changelog + version bump * #164 Removed superfluous isSome-operation * Update src/prologue/core/context.nim Co-authored-by: Philipp Doerner <philipp3000doerner@web.de> Co-authored-by: flywind <43030857+xflywind@users.noreply.github.com>
1 parent dfcaeef commit e456548

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.6.0
2+
3+
Added automatic URL decoding when fetching query parameters or path parameters from request object
4+
15
## 0.5.8
26

37
remove cursor annotation; Prologue should work with ORC (thanks to @Yardanico's advice)

prologue.nimble

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Package
22

3-
version = "0.5.8"
3+
version = "0.6.0"
44
author = "flywind"
55
description = "Prologue is an elegant and high performance web framework"
66
license = "Apache-2.0"

src/prologue/core/constants.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
const
2-
PrologueVersion* = "0.5.8" ## The current version of Prologue.
2+
PrologueVersion* = "0.6.0" ## The current version of Prologue.
33
ProloguePrefix* = "PROLOGUE" ## The helper prefix for environment variables.
44
useAsyncHTTPServer* = defined(windows) or defined(usestd) ## Uses `asynchttpserver`.

src/prologue/core/context.nim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ func getQueryParamsOption*(ctx: Context, key: string): Option[string] {.inline.}
353353
## Gets a param from the query strings. Returns none(string) if the param does not exist.
354354
## (for example, "www.google.com/hello?name=12", `name=12`).
355355
let hasQueryParam = ctx.request.queryParams.hasKey(key)
356-
result = if hasQueryParam: some(ctx.request.queryParams[key]) else: none(string)
356+
result = if hasQueryParam: some(decodeUrl(ctx.request.queryParams[key])) else: none(string)
357357

358358
func getQueryParams*(ctx: Context, key: string, default = ""): string {.inline.} =
359359
## Gets a param from the query strings(for example, "www.google.com/hello?name=12", `name=12`).
@@ -365,7 +365,7 @@ func getPathParamsOption*(ctx: Context, key: string): Option[string] {.inline.}
365365
## Gets a route parameter(for example, "/hello/{name}"). Returns none(string)
366366
## if the param does not exist.
367367
let hasPathParam = ctx.request.pathParams.hasKey(key)
368-
result = if hasPathParam: some(ctx.request.pathParams[key]) else: none(string)
368+
result = if hasPathParam: some(decodeUrl(ctx.request.pathParams[key])) else: none(string)
369369

370370
func getPathParams*(ctx: Context, key: string): string {.inline.} =
371371
## Gets the route parameters(for example, "/hello/{name}"). Returns an empty

0 commit comments

Comments
 (0)