Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Enabled hiding section headers in request #183

  • Loading branch information...
commit db3ac50f4efdcef96fe4e1262d5b01c157922ecd 1 parent eef570c
@alexadkins alexadkins authored
Showing with 10 additions and 4 deletions.
  1. +10 −4 public/javascripts/docs.js
View
14 public/javascripts/docs.js
@@ -227,10 +227,10 @@
resultContainer.append($(document.createElement('h4')).text('Call'));
resultContainer.append($(document.createElement('pre')).addClass('call'));
- resultContainer.append($(document.createElement('h4')).text('Request Headers'));
+ resultContainer.append($(document.createElement('h4')).addClass('reqHeadText').text('Request Headers'));
resultContainer.append($(document.createElement('pre')).addClass('requestHeaders'));
- resultContainer.append($(document.createElement('h4')).text('Request Body'));
+ resultContainer.append($(document.createElement('h4')).addClass('reqBodyText').text('Request Body'));
resultContainer.append($(document.createElement('pre')).addClass('requestBody'));
// Code
@@ -284,14 +284,19 @@
.text(response.call);
}
- if (response.requestHeaders) {
+ if (response.requestHeaders && !$.isEmptyObject(response.requestHeaders)) {
$('pre.requestHeaders', resultContainer)
.addClass('prettyprint')
.text(formatJSON(response.requestHeaders));
+ } else if ($.isEmptyObject(response.requestHeaders)) {
+ $('pre.requestHeaders', resultContainer).hide();
+ $('h4.reqHeadText').hide();
} else {
$('pre.requestHeaders', resultContainer).hide();
+ $('h4.reqHeadText').hide();
}
+
if (response.requestBody) {
var requestBody;
if (response.headers['content-type'].substr(0, 16) === 'application/json') {
@@ -301,7 +306,8 @@
}
$('pre.requestBody', resultContainer).addClass('prettyprint').text(requestBody);
} else {
- $('pre.requestHeaders', resultContainer).hide();
+ $('pre.requestBody', resultContainer).hide();
+ $('h4.reqBodyText').hide();
}
if (response.code) {
Please sign in to comment.
Something went wrong with that request. Please try again.