Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check type conversion of nethttp.DefaultTransport to *nethttp.Transport, return DefaultTransport on fail #161

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading