From f53cbde57726ae138813299f61b47c7fbe01c8dc Mon Sep 17 00:00:00 2001 From: steve Date: Mon, 18 Mar 2024 13:05:14 -0600 Subject: [PATCH 1/2] check type conversion of nethttp.DefaultTransport to *nethttp.Transport, return DefaultTransport on fail fixes microsoft/kiota-http-go#160 --- pipeline.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pipeline.go b/pipeline.go index 0135ac1..3112abf 100644 --- a/pipeline.go +++ b/pipeline.go @@ -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 From f07466839e140cd7a212bd87804472d02f720add Mon Sep 17 00:00:00 2001 From: steve Date: Mon, 18 Mar 2024 13:59:08 -0600 Subject: [PATCH 2/2] added changelog entry and bumped version in user agent handler to match --- CHANGELOG.md | 6 ++++++ user_agent_handler.go | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 016b32a..da2b6b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/user_agent_handler.go b/user_agent_handler.go index 552aca6..c984b8e 100644 --- a/user_agent_handler.go +++ b/user_agent_handler.go @@ -42,7 +42,7 @@ func NewUserAgentHandlerOptions() *UserAgentHandlerOptions { return &UserAgentHandlerOptions{ Enabled: true, ProductName: "kiota-go", - ProductVersion: "1.3.1", + ProductVersion: "1.3.3", } }