Skip to content
Snippets Groups Projects
user avatar
Sergey Bronnikov authored
@TarantoolBot document
Title: Document encoding HTTP parameters to a query string

New method uri.values() allows a user to represent multivalue
parameter's.

Setting multivalue parameter with `uri.parse()` and `uri.format()`:

```
> params = {q1 = uri.values("v1", "v2")}}
> uri.format({host = 'brnkv.ru', params = params})
---
- http://x.html?q1=v1&q1=v2
...

> uri.parse({"/tmp/unix.sock", params = params)
---
- host: unix/
  service: /tmp/unix.sock
  unix: /tmp/unix.sock
  params:
    q1:
    - v1
    - v2
...

```

Key and values could be a Lua number, string, boolean, anything that has
a `__serialize` or `__tostring` metamethod. It is possible to pass
`datetime`, `decimal` and `number64` values too.

NOTE: Order of keys with values in a result string is not deterministic.

Needed for #6832
ffe7408c
History
Name Last commit Last update