httpc: implement encoding params
@TarantoolBot document Title: Document encoding parameters in http client New option "params" passed to HTTP request allows a user to add query parameters into URI. When option "params" contains a Lua table with key-value pairs these parameters encoded to a string and passed as an URL path in GET/HEAD/DELETE methods and as a HTTP body with POST method. In a latter case error will be raised when body is not empty. ``` > uri = require("uri") > httpc = require("httpc") > params = { key1 = 'value1', key2 = uri.values('value1', 'value2') } > r = http.client.get("http://httpbin.org/get", { params = params }) > r.url --- - http://httpbin.org/get?key1=value1&key2=value1&key2=value2 ... ``` 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. Limitations: - order of keys with values in a result string is not deterministic - percent encoding is not supported at the moment Closes #6832
Showing
Loading
Please register or sign in to comment