Pomax / node-flickrapi

A node.js (and client-library) implementation of the Flickr API with oauth API key authentication and API method proxying
176 stars 51 forks source link

`body` sometimes undefined and flickrapi throws #64

Closed neojski closed 9 years ago

neojski commented 9 years ago

Sometimes the following happens:

/home/neo/repos/flickr-cli-uploadr/node_modules/flickrapi/src/utils.js:382
        if(body.indexOf('rsp stat="ok"')>-1) {
               ^
TypeError: Cannot read property 'indexOf' of undefined
    at Request._callback (/home/neo/repos/flickr-cli-uploadr/node_modules/flickrapi/src/utils.js:382:16)
    at self.callback (/home/neo/repos/flickr-cli-uploadr/node_modules/flickrapi/node_modules/request/index.js:148:22)
    at Request.emit (events.js:129:20)
    at ClientRequest.self.clientErrorHandler (/home/neo/repos/flickr-cli-uploadr/node_modules/flickrapi/node_modules/request/index.js:258:10)
    at ClientRequest.emit (events.js:107:17)
    at TLSSocket.socketOnEnd (_http_client.js:300:9)
    at TLSSocket.emit (events.js:129:20)
    at _stream_readable.js:908:16
    at process._tickCallback (node.js:355:11)

There should be additional check for error in request.post callback.

Pomax commented 9 years ago

good find - I've left some comments on the PR you filed