Module ringo/webapp/parameters
Functions
- isUrlEncoded(contentType)
- mergeParameter(params, name, value)
- parseParameters(bytes, params, encoding)
isUrlEncoded (contentType)
Find out whether the content type denotes a format this module can parse.
Parameters
| contentType | a HTTP request Content-Type header |
Returns
| true if the content type can be parsed as form data by this module |
mergeParameter (params, name, value)
Adds a value to a parameter object using a square bracket property syntax.
For example, parameter foo[bar][][baz]=hello will result in
object structure {foo: {bar: [{baz : "hello"}]}}.
Parameters
| params | the top level parameter object | |
| name | the parameter name | |
| value | the parameter value |
parseParameters (bytes, params, encoding)
Parse a byte array representing a query string or post data into an JavaScript object structure using the specified encoding.
Parameters
| bytes | a Binary object | |
| params | a parameter object to parse into | |
| encoding | a valid encoding name, defaults to UTF-8 |
