@@ -25,6 +25,7 @@ import * as is from 'is';
2525const isHtml = require ( 'is-html' ) ;
2626import { DecorateRequestOptions , BodyResponseCallback } from '@google-cloud/common/build/src/util' ;
2727import * as r from 'request' ;
28+ import { teenyRequest } from 'teeny-request' ;
2829
2930const PKG = require ( '../../package.json' ) ;
3031
@@ -148,6 +149,7 @@ export interface TranslateConfig extends GoogleAuthOptions {
148149 key ?: string ;
149150 autoRetry ?: boolean ;
150151 maxRetries ?: number ;
152+ requestModule ?: typeof teenyRequest ;
151153}
152154
153155/**
@@ -191,10 +193,12 @@ export class Translate extends Service {
191193 scopes : [ 'https://www.googleapis.com/auth/cloud-platform' ] ,
192194 packageJson : require ( '../../package.json' ) ,
193195 projectIdRequired : false ,
196+ requestModule : teenyRequest as typeof r ,
194197 } ;
195198
196199 super ( config , options ) ;
197200 this . options = options || { } ;
201+ this . options . requestModule = config . requestModule ;
198202 if ( this . options . key ) {
199203 this . key = this . options . key ;
200204 }
@@ -544,7 +548,7 @@ export class Translate extends Service {
544548 } ,
545549 } ) ;
546550
547- util . makeRequest ( reqOpts , this . options ! , callback ! ) ;
551+ util . makeRequest ( reqOpts , this . options , callback ! ) ;
548552 }
549553}
550554
0 commit comments