mashery / iodocs

Interactive API documentation system
MIT License
1.89k stars 415 forks source link

DELETE service returning 204 breaks ioDocs #209

Open sanderhouttekier opened 9 years ago

sanderhouttekier commented 9 years ago

when using a rest API, which returns status 204 no content after a succesful DELETE statement. The javascript of ioDoc fails as it is trying to get result.signin while result itself is undefined.

the node library node-restful is one that gives us this behavior at the moment: https://github.com/baugarten/node-restful

error in the frontend of ioDoc after calling one of the above delete statements:

Uncaught TypeError: Cannot read property 'signin' of undefined docs.js:273

I might take a deeper look into the code later this weekend and hopefully come up with some sort of a solution. not sure if i'm ready to fork and make a pull request but i'm definately going to try :)

DavidBiesack commented 9 years ago

I see the same thing; the UI shows pink and does not show the 204 HTTP status code

io docs delete 204

stdout log (with debug option on) shows

in processRequest
{ httpMethod: 'delete',
  oauth: '',
  methodUri: '/microUrls/{mId}',
  accessToken: '',
  json: '{"mId":"1i8av34q4a4un"}',
  locations: '{"mId":"path","MicroUrl":"body","MicroUrls":"body"}',
  values: [ '1i8av34q4a4un' ],
  apiKey: '',
  apiSecret: '',
  apiName: 'microurl' }
json:  { mId: '1i8av34q4a4un' }
locations:  { mId: 'path', MicroUrl: 'body', MicroUrls: 'body' }
Unsecured Call
{ headers: {},
  host: 'djb.na.sas.com',
  port: '',
  method: 'delete',
  path: '/mu/rest/microUrls/1i8av34q4a4un' }
Protocol: HTTP
HEADERS: {"server":"Apache-Coyote/1.1","date":"Wed, 08 Oct 2014 14:27:22 GMT"}
STATUS CODE: 204
10.23.16.105 - - [Wed, 08 Oct 2014 14:27:22 GMT] "POST /processReq HTTP/1.1" 204 - "http://djb.na.sas.com:3000/microurl" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.125 Safari/537.36"
phairow commented 9 years ago

looks like we need to change 'public/javascripts/docs.js' lines: 160, 166, 273

from: if (result.signin) { to: if (result && result.signin) {

chouchou900822 commented 9 years ago

I try it (result && result.signin), still not working.