# reqwest HTTP Client Library ## Function reqwest(url) Creates a synchronous HTTP request builder, supporting method, header, cookie, cookie_store, body, json, form, multipart, timeout, query, proxy, redirect_policy and send. ## API List | API | Description | | ------ | ------ | | [reqwest.method](/en/docs/reqwest/method) | Set the HTTP request method. | | [reqwest.header](/en/docs/reqwest/header) | Set one or a group of request headers. | | [reqwest.cookie](/en/docs/reqwest/cookie) | Set the Cookie request header. | | [reqwest.cookie_store](/en/docs/reqwest/cookie_store) | Enable or disable cookie storage for the current requesting client. | | [reqwest.body](/en/docs/reqwest/body) | Set the string request body. | | [reqwest.json](/en/docs/reqwest/json) | Set the JSON request body. | | [reqwest.form](/en/docs/reqwest/form) | Set application/x-www-form-urlencoded form request body. | | [reqwest.multipart](/en/docs/reqwest/multipart) | Set multipart/form-data request body. | | [reqwest.timeout](/en/docs/reqwest/timeout) | Set the request timeout. | | [reqwest.query](/en/docs/reqwest/query) | Append URL query parameters. | | [reqwest.proxy](/en/docs/reqwest/proxy) | Set HTTP/HTTPS proxy. | | [reqwest.redirect_policy](/en/docs/reqwest/redirect_policy) | Set redirect policy. | | [reqwest.send](/en/docs/reqwest/send) | Send an HTTP request synchronously and return a response object. | ## Examples ```bt response = reqwest('https://example.com').send() result = type(response) // Output: Object print result ``` ## Notes - The current VM is a synchronous model, send() will wait for the HTTP request to be completed synchronously; the underlying process-level I/O runtime is reused. -The HTTP client pool is enabled by default and is grouped and reused by proxy and redirection policies; the pool status can be viewed through `BT.stats().http`. - `cookie_store(true)` only acts on this `send()` and its redirect link, and does not enter the shared client pool to avoid cross-request cookie pollution. - Body, json, form, and multipart will all set the request body; the last request body set in the same request takes effect. HTTP client pool default configuration: | Environment variable | Default value | Description | | ------ | ------ | ------ | | BT_HTTP_CLIENT_POOL | true | Whether to enable the HTTP client pool. | | BT_HTTP_CLIENT_POOL_LIMIT | 32, maximum 1024 | Maximum number of client configuration groups to retain. | | BT_HTTP_CLIENT_IDLE_TTL_MS | 300000 | client idle retention time, in milliseconds; 0 means not to be eliminated based on idle time. | | BT_HTTP_SLOW_MS | 0 | Slow HTTP call log threshold, in milliseconds; 0 means off. |