mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-07 13:33:22 +00:00
Add readData proc that accepts a string.
This commit is contained in:
committed by
Andreas Rumpf
parent
c2c05f5e72
commit
d5e113c3a6
@@ -147,6 +147,12 @@ proc readData*(allowedMethods: set[RequestMethod] =
|
||||
for name, value in decodeData(allowedMethods):
|
||||
result[name.string] = value.string
|
||||
|
||||
proc readData*(data: string): StringTableRef =
|
||||
## Read CGI data from a string.
|
||||
result = newStringTable()
|
||||
for name, value in decodeData(data):
|
||||
result[name.string] = value.string
|
||||
|
||||
proc validateData*(data: StringTableRef, validKeys: varargs[string]) =
|
||||
## validates data; raises `ECgi` if this fails. This checks that each variable
|
||||
## name of the CGI `data` occurs in the `validKeys` array.
|
||||
|
||||
Reference in New Issue
Block a user