wcandillon / swagger-js-codegen

A Swagger Codegen for typescript, nodejs & angularjs
Apache License 2.0
693 stars 286 forks source link

TypeError: str.replace is not a function #189

Open DTPhil opened 7 years ago

DTPhil commented 7 years ago

I am getting the following error:

node_modules/request/lib/querystring.js:44
  return str.replace(/[!'()*]/g, function (c) {
             ^
TypeError: str.replace is not a function
    at Querystring.rfc3986 (/Users/user/GoogleDrive/NewProject/API/codegen_JS/node_modules/request/lib/querystring.js:44:14)
    at Request.json (/Users/user/GoogleDrive/NewProject/API/codegen_JS/node_modules/request/request.js:1305:30)
    at Request.init (/Users/user/GoogleDrive/NewProject/API/codegen_JS/node_modules/request/request.js:406:10)
    at new Request (/Users/user/GoogleDrive/NewProject/API/codegen_JS/node_modules/request/request.js:130:8)
    at request (/Users/user/GoogleDrive/NewProject/API/codegen_JS/node_modules/request/index.js:54:10)
    at DataTiger.request (/Users/user/GoogleDrive/NewProject/API/codegen_JS/nodejsSourceCode.js:73:9)
    at DataTiger.getApplications (/Users/user/GoogleDrive/NewProject/API/codegen_JS/nodejsSourceCode.js:211:14)
    at Object.<anonymous> (/Users/user/GoogleDrive/NewProject/API/codegen_JS/test.js:24:11)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)

When I comment out: //headers['Content-Type'] = ['application/x-www-form-urlencoded']; it works.

This seems to be an error with the library. Maybe this can be fixed via a change of headers?

Thanks!

Sudhakar12297 commented 6 years ago

Yeah just remove the header. It will work fine