|
|
2 ani în urmă | |
|---|---|---|
| .. | ||
| Makefile | 2 ani în urmă | |
| README.md | 2 ani în urmă | |
| client.go | 2 ani în urmă | |
The Client is useful when working with multiple hostnames.
See the simplest sendGetRequest() for GET and more advanced sendPostRequest() for a POST request.
The sendPostRequest() also shows:
DoTimeout()SetBodyRaw(). This is useful if you generated a request body. Otherwise, prefer SetBody() which copies it.Start a web server on localhost:8080 then execute:
make
./client
Internally the Client creates a dedicated HostClient for each domain/IP address and cleans unused after period of time. So if you have a single heavily loaded API endpoint it's better to use HostClient. See an example in the examples/host_client