From 6a1707e3ba7c22cc5744eab17adba40dfd05fe85 Mon Sep 17 00:00:00 2001 From: Bjoern Rochel Date: Thu, 16 Apr 2015 11:59:27 +0200 Subject: [PATCH 1/2] Prevent the OperationView to display an error in case the response contains a whitespace only body with content type application/json --- src/main/javascript/view/OperationView.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/javascript/view/OperationView.js b/src/main/javascript/view/OperationView.js index 6d673974f86..214bfa1f604 100644 --- a/src/main/javascript/view/OperationView.js +++ b/src/main/javascript/view/OperationView.js @@ -549,6 +549,7 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({ url = response.request.url; } var headers = response.headers; + content = content.trim(); // if server is nice, and sends content-type back, we can use it var contentType = null; From 569830b4ac97cd3ebb12186212a8ef9a9e49d682 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bjo=CC=88rn=20Rochel?= Date: Thu, 16 Apr 2015 20:37:19 +0200 Subject: [PATCH 2/2] Use jQuery for trimming --- src/main/javascript/view/OperationView.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/javascript/view/OperationView.js b/src/main/javascript/view/OperationView.js index 214bfa1f604..509ca782dc7 100644 --- a/src/main/javascript/view/OperationView.js +++ b/src/main/javascript/view/OperationView.js @@ -549,7 +549,7 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({ url = response.request.url; } var headers = response.headers; - content = content.trim(); + content = jQuery.trim(content); // if server is nice, and sends content-type back, we can use it var contentType = null;