Add readData proc that accepts a string.
This commit is contained in:
parent
c2c05f5e72
commit
d5e113c3a6
1 changed files with 6 additions and 0 deletions
|
|
@ -147,6 +147,12 @@ proc readData*(allowedMethods: set[RequestMethod] =
|
||||||
for name, value in decodeData(allowedMethods):
|
for name, value in decodeData(allowedMethods):
|
||||||
result[name.string] = value.string
|
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]) =
|
proc validateData*(data: StringTableRef, validKeys: varargs[string]) =
|
||||||
## validates data; raises `ECgi` if this fails. This checks that each variable
|
## validates data; raises `ECgi` if this fails. This checks that each variable
|
||||||
## name of the CGI `data` occurs in the `validKeys` array.
|
## name of the CGI `data` occurs in the `validKeys` array.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue