Merge pull request #49 from srinandan/master
ensure response content-type is not null
diff --git a/json2xml/index.js b/json2xml/index.js
index 8548727..8bff3d8 100644
--- a/json2xml/index.js
+++ b/json2xml/index.js
@@ -156,9 +156,9 @@
if (data && data.length > 0 && disable == false) accumulateResponse(res, data);
var contentType = res.getHeader('content-type');
- if (contentType.indexOf("application/xml") > -1) {
+ if (contentType && contentType.indexOf("application/xml") > -1) {
responseIsXML = true;
- } else if (contentType.indexOf("application/json") > -1) {
+ } else if (contentType && contentType.indexOf("application/json") > -1) {
responseIsJSON = true;
}