Skip to content

Commit bbb2a23

Browse files
docs: document raw responses
1 parent da625f4 commit bbb2a23

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

README.md

+24
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,30 @@ client.Runners.New(
242242
)
243243
```
244244

245+
### Accessing raw response data (e.g. response headers)
246+
247+
You can access the raw HTTP response data by using the `option.WithResponseInto()` request option. This is useful when
248+
you need to examine response headers, status codes, or other details.
249+
250+
```go
251+
// Create a variable to store the HTTP response
252+
var response *http.Response
253+
runner, err := client.Runners.New(
254+
context.TODO(),
255+
gitpod.RunnerNewParams{
256+
ConnectProtocolVersion: gitpod.F(gitpod.RunnerNewParamsConnectProtocolVersion1),
257+
},
258+
option.WithResponseInto(&response),
259+
)
260+
if err != nil {
261+
// handle error
262+
}
263+
fmt.Printf("%+v\n", runner)
264+
265+
fmt.Printf("Status Code: %d\n", response.StatusCode)
266+
fmt.Printf("Headers: %+#v\n", response.Header)
267+
```
268+
245269
### Making custom/undocumented requests
246270

247271
This library is typed for convenient access to the documented API. If you need to access undocumented

0 commit comments

Comments
 (0)