Skip to content

Commit

Permalink
Merge pull request #161 from steveruckdashel/unchecked-type-convertio…
Browse files Browse the repository at this point in the history
…n-default-transport

check type conversion of nethttp.DefaultTransport to *nethttp.Transport, return DefaultTransport on fail
  • Loading branch information
baywet authored Mar 19, 2024
2 parents 51c8f26 + f074668 commit ca399ad
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
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.3.3] - 2024-03-19

- Fix bug where overriding http.DefaultTransport with an implementation other than http.Transport would result in an interface conversion panic

### Changed

## [1.3.2] - 2024-02-28

### Changed
Expand Down
6 changes: 5 additions & 1 deletion pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,11 @@ func (transport *customTransport) RoundTrip(req *nethttp.Request) (*nethttp.Resp

// GetDefaultTransport returns the default http transport used by the library
func GetDefaultTransport() nethttp.RoundTripper {
defaultTransport := nethttp.DefaultTransport.(*nethttp.Transport).Clone()
defaultTransport, ok := nethttp.DefaultTransport.(*nethttp.Transport)
if !ok {
return nethttp.DefaultTransport
}
defaultTransport = defaultTransport.Clone()
defaultTransport.ForceAttemptHTTP2 = true
defaultTransport.DisableCompression = false
return defaultTransport
Expand Down
2 changes: 1 addition & 1 deletion user_agent_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func NewUserAgentHandlerOptions() *UserAgentHandlerOptions {
return &UserAgentHandlerOptions{
Enabled: true,
ProductName: "kiota-go",
ProductVersion: "1.3.1",
ProductVersion: "1.3.3",
}
}

Expand Down

0 comments on commit ca399ad

Please sign in to comment.