Skip to content

Commit

Permalink
Merge pull request #142 from microsoft/fix/context-timeout
Browse files Browse the repository at this point in the history
Fix context timeout
  • Loading branch information
baywet authored Jan 22, 2024
2 parents 9475b23 + 2453888 commit 1430a26
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

## [1.2.1] - 2023-01-22

### Changed

- Fix bug passing no timeout in client as 0 timeout in context .

## [1.2.0] - 2024-01-22

### Added
Expand Down
3 changes: 2 additions & 1 deletion nethttp_request_adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@ func (a *NetHttpRequestAdapter) prepareContext(ctx context.Context, requestInfo
ctx = context.Background()
}
// set deadline if not set in receiving context
if _, deadlineSet := ctx.Deadline(); !deadlineSet {
// ignore if timeout is 0 as it means no timeout
if _, deadlineSet := ctx.Deadline(); !deadlineSet && a.httpClient.Timeout != 0 {
ctx, _ = context.WithTimeout(ctx, a.httpClient.Timeout)
}

Expand Down

0 comments on commit 1430a26

Please sign in to comment.