File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -52,6 +52,14 @@ class Polly extends Helper {
5252 }
5353 }
5454
55+ _validateConfig ( config ) {
56+ const { url = '' } = config ;
57+ if ( typeof url !== 'string' ) {
58+ throw new Error ( `Expected type of url(in Polly-config) is string, Found ${ typeof url } .` ) ;
59+ }
60+ return config ;
61+ }
62+
5563 async _after ( ) {
5664 await this . stopMocking ( ) ;
5765 }
Original file line number Diff line number Diff line change @@ -306,6 +306,12 @@ function joinUrl(baseUrl, url) {
306306}
307307
308308module . exports . appendBaseUrl = function ( baseUrl = '' , oneOrMoreUrls ) {
309+ if ( typeof baseUrl !== 'string' ) {
310+ throw new Error ( `Invalid value for baseUrl: ${ baseUrl } ` ) ;
311+ }
312+ if ( ! ( typeof oneOrMoreUrls === 'string' || Array . isArray ( oneOrMoreUrls ) ) ) {
313+ throw new Error ( `Expected type of Urls is 'string' or 'array', Found '${ typeof oneOrMoreUrls } '.` ) ;
314+ }
309315 // Remove '/' if it's at the end of baseUrl
310316 const lastChar = baseUrl . substr ( - 1 ) ;
311317 if ( lastChar === '/' ) {
You can’t perform that action at this time.
0 commit comments