From 7dd5142df2e6c39c75f121aaf1e6eab5e9b895ad Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Mon, 27 Jan 2014 07:13:12 -0800 Subject: [PATCH] fix for #381 --- dist/lib/swagger.js | 39 +++++++++++++++++++++++++++++++++------ lib/swagger.js | 39 +++++++++++++++++++++++++++++++++------ package.json | 2 +- 3 files changed, 67 insertions(+), 13 deletions(-) diff --git a/dist/lib/swagger.js b/dist/lib/swagger.js index 117e0c83..6089c634 100644 --- a/dist/lib/swagger.js +++ b/dist/lib/swagger.js @@ -1188,19 +1188,46 @@ } cb = obj.on; res = { - error: function(response) { + error: function(raw) { + var headers, out; if (obj) { - return cb.error(response); + headers = raw._headers; + out = { + headers: headers, + url: raw.request.url, + method: raw.request.method, + status: raw.status, + data: raw.content.data + }; + return cb.error(out); } }, - redirect: function(response) { + redirect: function(raw) { + var headers, out; if (obj) { - return cb.redirect(response); + headers = raw._headers; + out = { + headers: headers, + url: raw.request.url, + method: raw.request.method, + status: raw.status, + data: raw.content.data + }; + return cb.redirect(out); } }, - 307: function(response) { + 307: function(raw) { + var headers, out; if (obj) { - return cb.redirect(response); + headers = raw._headers; + out = { + headers: headers, + url: raw.request.url, + method: raw.request.method, + status: raw.status, + data: raw.content.data + }; + return cb.redirect(out); } }, response: function(raw) { diff --git a/lib/swagger.js b/lib/swagger.js index 117e0c83..6089c634 100644 --- a/lib/swagger.js +++ b/lib/swagger.js @@ -1188,19 +1188,46 @@ } cb = obj.on; res = { - error: function(response) { + error: function(raw) { + var headers, out; if (obj) { - return cb.error(response); + headers = raw._headers; + out = { + headers: headers, + url: raw.request.url, + method: raw.request.method, + status: raw.status, + data: raw.content.data + }; + return cb.error(out); } }, - redirect: function(response) { + redirect: function(raw) { + var headers, out; if (obj) { - return cb.redirect(response); + headers = raw._headers; + out = { + headers: headers, + url: raw.request.url, + method: raw.request.method, + status: raw.status, + data: raw.content.data + }; + return cb.redirect(out); } }, - 307: function(response) { + 307: function(raw) { + var headers, out; if (obj) { - return cb.redirect(response); + headers = raw._headers; + out = { + headers: headers, + url: raw.request.url, + method: raw.request.method, + status: raw.status, + data: raw.content.data + }; + return cb.redirect(out); } }, response: function(raw) { diff --git a/package.json b/package.json index 1b9112a8..55bc4471 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "readmeFilename": "README.md", "dependencies": { "coffee-script": "~1.5.0", - "swagger-client": "2.0.9", + "swagger-client": "2.0.10", "handlebars": "~1.0.10", "less": "~1.4.2" }