couch-client
couch-client copied to clipboard
HEAD requests fail
When I try to perform a HEAD request I get this:
undefined:0
^
SyntaxError: Unexpected end of input
at Object.parse (native)
at IncomingMessage.<anonymous> (/usr/local/lib/node/.npm/couch-client/0.0.4/package/lib/cou ch-client.js:80:45)
at IncomingMessage.emit (events.js:81:20)
at HTTPParser.onMessageComplete (http.js:132:23)
at Socket.ondata (http.js:1206:22)
at Socket._onReadable (net.js:675:27)
at IOWatcher.onReadable [as callback] (net.js:177:10)
Does couch-client support HEAD requests?
I came across this as well. I wanted the response status from HEAD requests so I changed line 81 in my copy of lib/couch-client.js to:
if (callback) {
if (options.method === 'HEAD') {
callback(null, response.statusCode);
} else {
callback(null, JSON.parse(body));
}
}