diff --git a/APIBlueprintGenerator.coffee b/APIBlueprintGenerator.coffee index 63f989b..b0e9c10 100644 --- a/APIBlueprintGenerator.coffee +++ b/APIBlueprintGenerator.coffee @@ -26,8 +26,12 @@ APIBlueprintGenerator = -> body_indentation = ' ' if has_headers body_indentation += ' ' + try + body = JSON.stringify(JSON.parse(body), null, 2) + body = "" if body is "OK" body = body.replace(/^/gm, body_indentation) + return { statusCode: exchange.responseStatusCode, contentType: exchange.responseHeaders['Content-Type'], @@ -58,6 +62,8 @@ APIBlueprintGenerator = -> body_indentation = ' ' if has_headers body_indentation += ' ' + try + body = JSON.stringify(JSON.parse(body), null, 2) body = body.replace(/^/gm, body_indentation) if has_headers || has_body || paw_request.headers['Content-Type'] diff --git a/apiblueprint.mustache b/apiblueprint.mustache index 0fc72ad..5ab57ed 100644 --- a/apiblueprint.mustache +++ b/apiblueprint.mustache @@ -1,4 +1,4 @@ -# {{{ method }}} {{{ path }}} +**{{{ method }}} {{{ path }}}** {{#request}} + Request{{#contentType}} ({{{contentType}}}){{/contentType}}