File tree Expand file tree Collapse file tree 4 files changed +11
-7
lines changed
modules/openapi-generator/src/main/java/org/openapitools/codegen/languages
javascript-promise-es6/src Expand file tree Collapse file tree 4 files changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
4343| sourceFolder| source folder for generated code| | src|
4444| useInheritance| use JavaScript prototype chains & ; delegation for inheritance| | true|
4545| usePromises| use Promises as return values from the client API, instead of superagent callbacks| | false|
46- | useURLSearchParams| use JS build-in UrlSearchParams, instead of deprecated npm lib 'querystring'| | false |
46+ | useURLSearchParams| use JS build-in UrlSearchParams, instead of deprecated npm lib 'querystring'| | true |
4747
4848## IMPORT MAPPING
4949
Original file line number Diff line number Diff line change @@ -81,7 +81,7 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
8181 protected boolean useES6 = true ; // default is ES6
8282 @ Setter protected String npmRepository = null ;
8383 @ Getter private String modelPropertyNaming = "camelCase" ;
84- @ Setter protected boolean useURLSearchParams = false ;
84+ @ Setter protected boolean useURLSearchParams = true ;
8585
8686 public JavascriptClientCodegen () {
8787 super ();
@@ -194,7 +194,7 @@ public JavascriptClientCodegen() {
194194 cliOptions .add (new CliOption (NPM_REPOSITORY , "Use this property to set an url your private npmRepo in the package.json" ));
195195 cliOptions .add (new CliOption (USE_URL_SEARCH_PARAMS ,
196196 "use JS build-in UrlSearchParams, instead of deprecated npm lib 'querystring'" )
197- .defaultValue (Boolean .FALSE .toString ())
197+ .defaultValue (Boolean .TRUE .toString ())
198198 );
199199
200200 supportedLibraries .put (LIBRARY_JAVASCRIPT , "JavaScript client library" );
Original file line number Diff line number Diff line change 1313
1414
1515import superagent from "superagent" ;
16- import querystring from "querystring" ;
1716
1817/**
1918* @module ApiClient
@@ -443,7 +442,10 @@ class ApiClient {
443442 }
444443
445444 if ( contentType === 'application/x-www-form-urlencoded' ) {
446- request . send ( querystring . stringify ( this . normalizeParams ( formParams ) ) ) ;
445+ let normalizedParams = this . normalizeParams ( formParams )
446+ let urlSearchParams = new URLSearchParams ( normalizedParams ) ;
447+ let queryString = urlSearchParams . toString ( ) ;
448+ request . send ( queryString ) ;
447449 } else if ( contentType == 'multipart/form-data' ) {
448450 var _formParams = this . normalizeParams ( formParams ) ;
449451 for ( var key in _formParams ) {
Original file line number Diff line number Diff line change 1313
1414
1515import superagent from "superagent" ;
16- import querystring from "querystring" ;
1716
1817/**
1918* @module ApiClient
@@ -435,7 +434,10 @@ class ApiClient {
435434 }
436435
437436 if ( contentType === 'application/x-www-form-urlencoded' ) {
438- request . send ( querystring . stringify ( this . normalizeParams ( formParams ) ) ) ;
437+ let normalizedParams = this . normalizeParams ( formParams )
438+ let urlSearchParams = new URLSearchParams ( normalizedParams ) ;
439+ let queryString = urlSearchParams . toString ( ) ;
440+ request . send ( queryString ) ;
439441 } else if ( contentType == 'multipart/form-data' ) {
440442 var _formParams = this . normalizeParams ( formParams ) ;
441443 for ( var key in _formParams ) {
You can’t perform that action at this time.
0 commit comments