reqwest.send

reqwest.send

reqwest.send

Function

Send HTTP requests synchronously and return response objects.

Syntax

Parameters

No parameters.

Return value

TypeDescription
ObjectReturns the HTTP response object.

Response object fields

FieldTypeMust existDescription
statusIntYesHTTP response status code, such as 200, 404, 500.
bodyStringYesThe response body text.
headersObjectYesThe response header object. The key is the response header name and the value is the response header string value.

Example

Notes

  • send() will wait for the request to be completed synchronously; the underlying layer reuses the process-level I/O runtime.
  • The HTTP client pool is enabled by default, and clients are grouped and reused according to proxy and redirection policies; a single timeout does not participate in the pool key and will still take effect according to this request.
  • Requests that enable cookie_store(true) will not enter the shared client pool, and the cookie is only retained in this sending and redirection link.
  • You can view the number of pool entries, hits, eliminations, creation failures and slow calls through BT.stats().http.