@@ -29,7 +29,7 @@ import { HttpPlugin, plugin } from '../../src/http';
2929import { assertSpan } from '../utils/assertSpan' ;
3030import { DummyPropagation } from '../utils/DummyPropagation' ;
3131import { httpRequest } from '../utils/httpRequest' ;
32- import * as utils from '../../src/utils' ;
32+ import { OT_REQUEST_HEADER } from '../../src/utils' ;
3333import { HttpPluginConfig , Http } from '../../src/types' ;
3434import { AttributeNames } from '../../src/enums/AttributeNames' ;
3535
@@ -77,8 +77,8 @@ describe('HttpPlugin', () => {
7777 assert . strictEqual ( process . versions . node , plugin . version ) ;
7878 } ) ;
7979
80- it ( ' moduleName should be http' , ( ) => {
81- assert . strictEqual ( 'http' , plugin . moduleName ) ;
80+ it ( ` moduleName should be ${ protocol } ` , ( ) => {
81+ assert . strictEqual ( protocol , plugin . moduleName ) ;
8282 } ) ;
8383
8484 describe ( 'enable()' , ( ) => {
@@ -123,7 +123,7 @@ describe('HttpPlugin', () => {
123123
124124 it ( 'should generate valid spans (client side and server side)' , async ( ) => {
125125 const result = await httpRequest . get (
126- `http ://${ hostname } :${ serverPort } ${ pathname } `
126+ `${ protocol } ://${ hostname } :${ serverPort } ${ pathname } `
127127 ) ;
128128 const spans = memoryExporter . getFinishedSpans ( ) ;
129129 const [ incomingSpan , outgoingSpan ] = spans ;
@@ -142,14 +142,14 @@ describe('HttpPlugin', () => {
142142 assertSpan ( outgoingSpan , SpanKind . CLIENT , validations ) ;
143143 } ) ;
144144
145- it ( `should not trace requests with '${ utils . OT_REQUEST_HEADER } ' header` , async ( ) => {
145+ it ( `should not trace requests with '${ OT_REQUEST_HEADER } ' header` , async ( ) => {
146146 const testPath = '/outgoing/do-not-trace' ;
147147 doNock ( hostname , testPath , 200 , 'Ok' ) ;
148148
149149 const options = {
150150 host : hostname ,
151151 path : testPath ,
152- headers : { [ utils . OT_REQUEST_HEADER ] : 1 } ,
152+ headers : { [ OT_REQUEST_HEADER ] : 1 } ,
153153 } ;
154154
155155 const result = await httpRequest . get ( options ) ;
@@ -171,7 +171,7 @@ describe('HttpPlugin', () => {
171171 ( url : string ) => url . endsWith ( `/ignored/function` ) ,
172172 ] ,
173173 ignoreOutgoingUrls : [
174- `http ://${ hostname } :${ serverPort } /ignored/string` ,
174+ `${ protocol } ://${ hostname } :${ serverPort } /ignored/string` ,
175175 / \/ i g n o r e d \/ r e g e x p $ / i,
176176 ( url : string ) => url . endsWith ( `/ignored/function` ) ,
177177 ] ,
@@ -190,11 +190,11 @@ describe('HttpPlugin', () => {
190190 plugin . disable ( ) ;
191191 } ) ;
192192
193- it ( 'http module should be patched' , ( ) => {
193+ it ( ` ${ protocol } module should be patched` , ( ) => {
194194 assert . strictEqual ( http . Server . prototype . emit . __wrapped , true ) ;
195195 } ) ;
196196
197- it ( " should not patch if it's not a http module" , ( ) => {
197+ it ( ` should not patch if it's not a ${ protocol } module` , ( ) => {
198198 const httpNotPatched = new HttpPlugin (
199199 plugin . component ,
200200 process . versions . node
@@ -204,7 +204,7 @@ describe('HttpPlugin', () => {
204204
205205 it ( 'should generate valid spans (client side and server side)' , async ( ) => {
206206 const result = await httpRequest . get (
207- `http ://${ hostname } :${ serverPort } ${ pathname } `
207+ `${ protocol } ://${ hostname } :${ serverPort } ${ pathname } `
208208 ) ;
209209 const spans = memoryExporter . getFinishedSpans ( ) ;
210210 const [ incomingSpan , outgoingSpan ] = spans ;
@@ -223,14 +223,14 @@ describe('HttpPlugin', () => {
223223 assertSpan ( outgoingSpan , SpanKind . CLIENT , validations ) ;
224224 } ) ;
225225
226- it ( `should not trace requests with '${ utils . OT_REQUEST_HEADER } ' header` , async ( ) => {
226+ it ( `should not trace requests with '${ OT_REQUEST_HEADER } ' header` , async ( ) => {
227227 const testPath = '/outgoing/do-not-trace' ;
228228 doNock ( hostname , testPath , 200 , 'Ok' ) ;
229229
230230 const options = {
231231 host : hostname ,
232232 path : testPath ,
233- headers : { [ utils . OT_REQUEST_HEADER ] : 1 } ,
233+ headers : { [ OT_REQUEST_HEADER ] : 1 } ,
234234 } ;
235235
236236 const result = await httpRequest . get ( options ) ;
@@ -395,13 +395,13 @@ describe('HttpPlugin', () => {
395395 }
396396
397397 for ( const arg of [ 'string' , { } , new Date ( ) ] ) {
398- it ( `should be tracable and not throw exception in http plugin when passing the following argument ${ JSON . stringify (
398+ it ( `should be tracable and not throw exception in ${ protocol } plugin when passing the following argument ${ JSON . stringify (
399399 arg
400400 ) } `, async ( ) => {
401401 try {
402402 await httpRequest . get ( arg ) ;
403403 } catch ( error ) {
404- // http request has been made
404+ // request has been made
405405 // nock throw
406406 assert . ok ( error . message . startsWith ( 'Nock: No match for request' ) ) ;
407407 }
@@ -411,14 +411,14 @@ describe('HttpPlugin', () => {
411411 }
412412
413413 for ( const arg of [ true , 1 , false , 0 , '' ] ) {
414- it ( `should not throw exception in http plugin when passing the following argument ${ JSON . stringify (
414+ it ( `should not throw exception in ${ protocol } plugin when passing the following argument ${ JSON . stringify (
415415 arg
416416 ) } `, async ( ) => {
417417 try {
418418 // @ts -ignore
419419 await httpRequest . get ( arg ) ;
420420 } catch ( error ) {
421- // http request has been made
421+ // request has been made
422422 // nock throw
423423 assert . ok (
424424 error . stack . indexOf (
@@ -447,7 +447,7 @@ describe('HttpPlugin', () => {
447447
448448 const promiseRequest = new Promise ( ( resolve , reject ) => {
449449 const req = http . request (
450- `http ://${ hostname } ${ testPath } ` ,
450+ `${ protocol } ://${ hostname } ${ testPath } ` ,
451451 ( resp : http . IncomingMessage ) => {
452452 let data = '' ;
453453 resp . on ( 'data' , chunk => {
@@ -488,7 +488,7 @@ describe('HttpPlugin', () => {
488488
489489 const promiseRequest = new Promise ( ( resolve , reject ) => {
490490 const req = http . request (
491- `http ://${ hostname } ${ testPath } ` ,
491+ `${ protocol } ://${ hostname } ${ testPath } ` ,
492492 ( resp : http . IncomingMessage ) => {
493493 let data = '' ;
494494 resp . on ( 'data' , chunk => {
@@ -512,14 +512,14 @@ describe('HttpPlugin', () => {
512512 } ) ;
513513
514514 it ( 'should have 1 ended span when request is aborted' , async ( ) => {
515- nock ( 'http ://my.server.com' )
515+ nock ( ` ${ protocol } ://my.server.com` )
516516 . get ( '/' )
517517 . socketDelay ( 50 )
518518 . reply ( 200 , '<html></html>' ) ;
519519
520520 const promiseRequest = new Promise ( ( resolve , reject ) => {
521521 const req = http . request (
522- 'http ://my.server.com' ,
522+ ` ${ protocol } ://my.server.com` ,
523523 ( resp : http . IncomingMessage ) => {
524524 let data = '' ;
525525 resp . on ( 'data' , chunk => {
0 commit comments