Skip to content

Commit

Permalink
feat(api): api update (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed Oct 23, 2024
1 parent afaa4cf commit 0aa617e
Showing 1 changed file with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,12 @@ private constructor(
}
}

override fun close() {
httpClient.close()
}
override fun close() = httpClient.close()

private fun isRetryable(request: HttpRequest): Boolean {
private fun isRetryable(request: HttpRequest): Boolean =
// Some requests, such as when a request body is being streamed, cannot be retried because
// the body data aren't available on subsequent attempts.
return request.body?.repeatable() ?: true
}
request.body?.repeatable() ?: true

private fun setRetryCountHeader(request: HttpRequest, retries: Int) {
request.headers.removeAll("x-stainless-retry-count")
Expand Down Expand Up @@ -153,12 +150,11 @@ private constructor(
}
}

private fun shouldRetry(throwable: Throwable): Boolean {
private fun shouldRetry(throwable: Throwable): Boolean =
// Only retry IOException and OnebusawaySdkIoException, other exceptions are not intended to
// be
// retried.
return throwable is IOException || throwable is OnebusawaySdkIoException
}
throwable is IOException || throwable is OnebusawaySdkIoException

private fun getRetryBackoffMillis(retries: Int, response: HttpResponse?): Duration {
// About the Retry-After header:
Expand Down

0 comments on commit 0aa617e

Please sign in to comment.