Skip to content

Commit 667a70e

Browse files
committed
update and clean up docs
1 parent a69904d commit 667a70e

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

README.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,26 @@ err := request.Do(params, result)
3737
```
3838
All parameters besides the `URL` and the `Method` are optional and can be omitted.
3939

40-
If you want to retrieve the response body as a string, e.g. for debugging or testing purposes, you can use `DoWithStringResponse` instead.
40+
### Accessing the response headers
41+
If you need access to the headers of the http response, you can initialize a header map and pass it as a third argument to `Do`.
42+
It will then be populated with the response headers that the server returns.
43+
44+
```go
45+
responseHeaders := http.Header{}
46+
err := request.Do(params, result, responseHeaders)
47+
```
48+
49+
### Using a custom http client
50+
If you want to supply a custom http client to use for the request, you can use `DoWithCustomClient`.
51+
The client needs to be of type `*http.Client`.
52+
53+
```go
54+
err := request.DoWithCustomClient(params, result)
55+
```
56+
57+
### Retrieving the response as a string
58+
If you want to retrieve the response body as a string, e.g. for debugging or testing purposes, you can use `DoWithStringResponse`.
59+
4160
```go
4261
result, err := request.DoWithStringResponse(params)
4362
```

0 commit comments

Comments
 (0)