@@ -86,17 +86,28 @@ module.exports = function (superagent, config, logger) {
86
86
const isNodeServer = this . hasOwnProperty ( 'cookies' ) ;
87
87
let response = { } ;
88
88
89
- if ( isNodeServer ) { // node server
90
- const originalPath = this . path ;
91
- this . path = this . url ;
92
- this . _appendQueryString ( this ) ; // use superagent implementation of adding the query
93
- path = this . path ; // save the url together with the query
94
- this . path = originalPath ; // reverse the addition of query to path by _appendQueryString
95
- } else { // client
89
+ if ( this . _finalizeQueryString ) {
90
+ // superagent 3.6+
91
+
96
92
const originalUrl = this . url ;
97
- this . _appendQueryString ( this ) ; // use superagent implementation of adding the query
98
- path = this . url ; // save the url together with the query
99
- this . url = originalUrl ; // reverse the addition of query to url by _appendQueryString
93
+ isNodeServer ? this . request ( ) : this . _finalizeQueryString ( this ) ;
94
+ path = this . url ;
95
+ this . url = originalUrl ;
96
+ } else {
97
+ // superagent < 3.6
98
+
99
+ if ( isNodeServer ) { // node server
100
+ const originalPath = this . path ;
101
+ this . path = this . url ;
102
+ this . _appendQueryString ( this ) ; // use superagent implementation of adding the query
103
+ path = this . path ; // save the url together with the query
104
+ this . path = originalPath ; // reverse the addition of query to path by _appendQueryString
105
+ } else { // client
106
+ const originalUrl = this . url ;
107
+ this . _appendQueryString ( this ) ; // use superagent implementation of adding the query
108
+ path = this . url ; // save the url together with the query
109
+ this . url = originalUrl ; // reverse the addition of query to url by _appendQueryString
110
+ }
100
111
}
101
112
102
113
// Attempt to match path against the patterns in fixtures
0 commit comments