api2swagger icon indicating copy to clipboard operation
api2swagger copied to clipboard

Execution error

Open colingoldberg opened this issue 7 years ago • 4 comments

Hi,

Two thumbs up for a great tool!

I got an error as follows when I tried it on a new IBM API. I know that the API requires a username and password, which I did not supply - just to see what happened. (Curl would have used -u "username:password").

In any event, I thought you would would want to know this.

$ api2swagger -X GET -e https://gateway.watsonplatform.net/natural-language-understanding/api/v1/analyze -o xx ? Title of Swagger Spec ? ibm nlu ? Description of Swagger Spec ? nat lang ? Terms of Service URL ? http://example.com/about/terms ? Version of your API Program ? 2017-02-27 ? Contact Name? cg ? Contact URL ? http://example.com/contact ? Contact Email ? [email protected] ? License Name ? Apache 2.0 ? License URL ? http://example.com ? Does your API supports http ? No ? Pick Base Path from your API ? /natural-language-understanding/api/v1/analyze ? A verbose explanation of the operation behavior. ? API Method Description ? A short summary of what the operation does. ? Short Summary of API Method ? Additional external documentation for this operation. ? http://docs.example.com/management/apis/get/entities ? Unique string used to identify the operation. ? aa ? A list of tags for API documentation control. ? api2swagger Making an API Call & fetching more details...Please stay tuned.. /usr/local/lib/node_modules/api2swagger/lib/execute/api.js:290 if (response.headers['content-type'].indexOf('application/json') > -1 && body != '') { ^

TypeError: Cannot read property 'indexOf' of undefined at Request._callback (/usr/local/lib/node_modules/api2swagger/lib/execute/api.js:290:41) at Request.self.callback (/usr/local/lib/node_modules/api2swagger/node_modules/request/request.js:188:22) at emitTwo (events.js:106:13) at Request.emit (events.js:194:7) at Request. (/usr/local/lib/node_modules/api2swagger/node_modules/request/request.js:1171:10) at emitOne (events.js:96:13) at Request.emit (events.js:191:7) at IncomingMessage. (/usr/local/lib/node_modules/api2swagger/node_modules/request/request.js:1091:12) at Object.onceWrapper (events.js:293:19) at emitNone (events.js:91:20)

Colin Goldberg

colingoldberg avatar Apr 06 '17 20:04 colingoldberg

Unfortunately I'm experiencing that exact same problem. Did you find a solution or workaround? Thx!

alexpr avatar May 08 '17 12:05 alexpr

I'm having this problem too. I'll submit a PR to fix it

ctuckz avatar Sep 16 '17 19:09 ctuckz

exact same issue I am facing too.

nitingautam avatar Apr 25 '19 02:04 nitingautam

Getting this issue also via npm 7.5.3 / nodejs v15.10.0 / macos catalina

plasx avatar Feb 25 '21 22:02 plasx