okta / okta-sdk-golang

A Golang SDK for interacting with the Okta management API, enabling server-side code to manage Okta users, groups, applications, and more.
https://github.com/okta/okta-sdk-golang
Other
174 stars 143 forks source link

Handle network errors and don't cancel context in request before reading response #369

Closed ttimonen closed 1 year ago

ttimonen commented 1 year ago

Summary

This changes the doWithRetries to return a cleanup func to be called once the response is read instead of taking it down prematurely. Also, and maybe more importantly: Report network errors instead of silently ignoring them and processing partial data.

This becomes an issue with large requests where there's a packet boundary between received headers and rest of the body.

Fixes #363

Type of PR

Test Information

Go Version: 1.20.3 Os Version: macOS Ventura 13.2.1 OpenAPI Spec Version: 2.15.0

Signoff

monde commented 1 year ago

I approve this PR. Our CI guards against external PRs running so we'll have to make an Okta branch and cherry pick this in. Thanks @ttimonen