@@ -78,7 +78,7 @@ export class Http2Plugin extends HttpPlugin {
78
78
return ( original : ConnectFunction ) : Func < http2 . ClientHttp2Session > => {
79
79
return function patchedConnect (
80
80
this : Http2Plugin ,
81
- authority : string
81
+ authority : string | url . URL
82
82
) : http2 . ClientHttp2Session {
83
83
const client = original . apply ( this , arguments ) ;
84
84
shimmer . wrap ( client , 'request' , original =>
@@ -96,7 +96,7 @@ export class Http2Plugin extends HttpPlugin {
96
96
const plugin = this ;
97
97
return (
98
98
original : RequestFunction ,
99
- authority : string
99
+ authority : string | url . URL
100
100
) : Func < http2 . ClientHttp2Stream > => {
101
101
return function patchedRequest (
102
102
this : http2 . Http2Session ,
@@ -148,7 +148,7 @@ export class Http2Plugin extends HttpPlugin {
148
148
private getMakeHttp2RequestTraceFunction (
149
149
request : http2 . ClientHttp2Stream ,
150
150
headers : http2 . OutgoingHttpHeaders ,
151
- authority : string ,
151
+ authority : string | url . URL ,
152
152
plugin : Http2Plugin
153
153
) : Func < http2 . ClientHttp2Stream > {
154
154
return ( span : Span ) : http2 . ClientHttp2Stream => {
@@ -178,7 +178,7 @@ export class Http2Plugin extends HttpPlugin {
178
178
const userAgent =
179
179
headers [ 'user-agent' ] || headers [ 'User-Agent' ] || null ;
180
180
181
- const host = url . parse ( authority ) . host ;
181
+ const host = ( authority instanceof url . URL ? authority : url . parse ( authority ) ) . host ;
182
182
if ( host ) {
183
183
span . addAttribute ( Http2Plugin . ATTRIBUTE_HTTP_HOST , host ) ;
184
184
}
0 commit comments