Commit abc36009 authored by Tony Tam's avatar Tony Tam
Browse files

Merge pull request #295 from tomrac87/hal_json

Proper formatting for "application/hal+json" Content-Type
parents 77882a0e ff05f911
......@@ -1735,7 +1735,7 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
if (content === void 0) {
code = $('<code />').text("no content");
pre = $('<pre class="json" />').append(code);
} else if (contentType.indexOf("application/json") === 0) {
} else if (contentType.indexOf("application/json") === 0 || contentType.indexOf("application/hal+json") === 0) {
code = $('<code />').text(JSON.stringify(JSON.parse(content), null, 2));
pre = $('<pre class="json" />').append(code);
} else if (contentType.indexOf("application/xml") === 0) {
......
......@@ -205,7 +205,7 @@ class OperationView extends Backbone.View
if content == undefined
code = $('<code />').text("no content")
pre = $('<pre class="json" />').append(code)
else if contentType.indexOf("application/json") == 0
else if contentType.indexOf("application/json") == 0 || contentType.indexOf("application/hal+json") == 0
code = $('<code />').text(JSON.stringify(JSON.parse(content), null, 2))
pre = $('<pre class="json" />').append(code)
else if contentType.indexOf("application/xml") == 0
......@@ -231,4 +231,4 @@ class OperationView extends Backbone.View
toggleOperationContent: ->
elem = $('#' + Docs.escapeResourceName(@model.resourceName) + "_" + @model.nickname + "_" + @model.method + "_" + @model.number + "_content")
if elem.is(':visible') then Docs.collapseOperation(elem) else Docs.expandOperation(elem)
\ No newline at end of file
if elem.is(':visible') then Docs.collapseOperation(elem) else Docs.expandOperation(elem)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment