tink_web
tink_web copied to clipboard
Dynamic parameter names
@:params(bar('bar-$_') in query)
function get(bar:DynamicAccess<String>);
and a request with ?bar-foo=a&bar-baz=b would be translated to {foo:'a', baz:'b'} in Haxe.
Any thoughts?
Well, the main problem here is parsing DynamicAccess, which is currently unsupported. It'll require restructuring how the data is stored in the parser, because getting maps from a flat key-value-list is not that easy. Especially if you consider more complex cases like DynamicAcces<String, { ?foo:String, ?bar:Int }>.
Query string is only part of the problem. I also want this to work with request headers. (Thanks to aws)
Yeah, but headers are basically a key-value list too ... both get parsed via tink_querystring, which despite its name is not that query string specific ^^