From 51699e22e3e04b70a8eeb75e51ae5cbabb519148 Mon Sep 17 00:00:00 2001 From: Nathan Brown Date: Mon, 17 Nov 2014 10:53:12 -0700 Subject: [PATCH 1/3] Set files as LF only. --- .gitattributes | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..d47055d8 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,4 @@ +# Set the default behavior. +* text=lf + +*.handlebars text eol=lf From 449aeb6ac1c78a1293bf2c1d3553766118812e9a Mon Sep 17 00:00:00 2001 From: Nathan Brown Date: Sun, 9 Nov 2014 19:08:22 -0700 Subject: [PATCH 2/3] Handle when a clicked link has parameters. --- chrome/js/modules/request.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/chrome/js/modules/request.js b/chrome/js/modules/request.js index 9b9fef5a..f2277a4c 100644 --- a/chrome/js/modules/request.js +++ b/chrome/js/modules/request.js @@ -1420,6 +1420,8 @@ pm.request = { } this.refreshLayout(); + var newRows = getUrlVars($('#url').val(), false); + $('#url-keyvaleditor').keyvalueeditor('reset', newRows); }, isMethodWithBody:function (method) { From 0fe38610148c1b037411788c328af572c0f25e15 Mon Sep 17 00:00:00 2001 From: Nathan Brown Date: Sun, 9 Nov 2014 19:14:44 -0700 Subject: [PATCH 3/3] Hyperlink the URLs in the Link (RFC 5988) header. --- chrome/js/modules/layout.js | 21 +++ chrome/js/modules/request.js | 4 + chrome/js/templates.js | 151 ++++++++++-------- .../templates/item_response_header.handlebars | 8 +- 4 files changed, 117 insertions(+), 67 deletions(-) diff --git a/chrome/js/modules/layout.js b/chrome/js/modules/layout.js index 6c9c8034..ecdb172a 100644 --- a/chrome/js/modules/layout.js +++ b/chrome/js/modules/layout.js @@ -264,6 +264,12 @@ pm.layout = { pm.request.loadRequestFromLink(link, headers); }); + $('#response-headers').on("mousedown", ".cm-link", function () { + var link = $(this).text(); + var headers = $('#headers-keyvaleditor').keyvalueeditor('getValues'); + pm.request.loadRequestFromLink(link, headers); + }); + $('.response-tabs').on("click", "li", function () { var section = $(this).attr('data-section'); if (section === "body") { @@ -285,6 +291,21 @@ pm.layout = { $('.request-meta-actions').css("display", "none"); }); + var linkRegex = /(\s*<\s*)([^>]*)(\s*>[^,]*,?)/g; + + var linkFunc = function (all, pre_uri, uri, post_uri) { + return Handlebars.Utils.escapeExpression(pre_uri) + + "" + + uri + + "" + + Handlebars.Utils.escapeExpression(post_uri); + }; + + Handlebars.registerHelper('link_to_hyperlink', function(linkValue) { + var output = linkValue.replace(linkRegex, linkFunc); + return new Handlebars.SafeString(output); + }); + this.attachModalHandlers(); this.setLayout(); }, diff --git a/chrome/js/modules/request.js b/chrome/js/modules/request.js index f2277a4c..267ea931 100644 --- a/chrome/js/modules/request.js +++ b/chrome/js/modules/request.js @@ -1470,6 +1470,10 @@ pm.request = { "description":headerDetails[name.toLowerCase()] }; + if (name.toLowerCase() === "link") { + header.isLink = true; + } + vars.push(header); } } diff --git a/chrome/js/templates.js b/chrome/js/templates.js index 13674f40..01202ab3 100644 --- a/chrome/js/templates.js +++ b/chrome/js/templates.js @@ -1,6 +1,6 @@ this["Handlebars"] = this["Handlebars"] || {}; -this["Handlebars"]["templates"] = this["Handlebars"]["templates"] || {}; - +this["Handlebars"]["templates"] = this["Handlebars"]["templates"] || {}; + this["Handlebars"]["templates"]["broadcasts"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) { this.compilerInfo = [4,'>= 1.0.0']; helpers = this.merge(helpers, Handlebars.helpers); partials = this.merge(partials, Handlebars.partials); data = data || {}; @@ -20,8 +20,8 @@ function program1(depth0,data) { if(stack1 || stack1 === 0) { buffer += stack1; } buffer += "\n\n"; return buffer; - }); - + }); + this["Handlebars"]["templates"]["collection_selector_list"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) { this.compilerInfo = [4,'>= 1.0.0']; helpers = this.merge(helpers, Handlebars.helpers); partials = this.merge(partials, Handlebars.partials); data = data || {}; @@ -40,8 +40,8 @@ function program1(depth0,data) { stack1 = helpers.each.call(depth0, depth0.items, {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data}); if(stack1 || stack1 === 0) { return stack1; } else { return ''; } - }); - + }); + this["Handlebars"]["templates"]["collection_sidebar"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) { this.compilerInfo = [4,'>= 1.0.0']; helpers = this.merge(helpers, Handlebars.helpers); partials = this.merge(partials, Handlebars.partials); data = data || {}; @@ -60,8 +60,8 @@ function program1(depth0,data) { stack1 = helpers.each.call(depth0, depth0.items, {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data}); if(stack1 || stack1 === 0) { return stack1; } else { return ''; } - }); - + }); + this["Handlebars"]["templates"]["environment_list"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) { this.compilerInfo = [4,'>= 1.0.0']; helpers = this.merge(helpers, Handlebars.helpers); partials = this.merge(partials, Handlebars.partials); data = data || {}; @@ -80,8 +80,8 @@ function program1(depth0,data) { stack1 = helpers.each.call(depth0, depth0.items, {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data}); if(stack1 || stack1 === 0) { return stack1; } else { return ''; } - }); - + }); + this["Handlebars"]["templates"]["environment_quicklook"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) { this.compilerInfo = [4,'>= 1.0.0']; helpers = this.merge(helpers, Handlebars.helpers); partials = this.merge(partials, Handlebars.partials); data = data || {}; @@ -100,8 +100,8 @@ function program1(depth0,data) { stack1 = helpers.each.call(depth0, depth0.items, {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data}); if(stack1 || stack1 === 0) { return stack1; } else { return ''; } - }); - + }); + this["Handlebars"]["templates"]["environment_selector"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) { this.compilerInfo = [4,'>= 1.0.0']; helpers = this.merge(helpers, Handlebars.helpers); partials = this.merge(partials, Handlebars.partials); data = data || {}; @@ -120,8 +120,8 @@ function program1(depth0,data) { stack1 = helpers.each.call(depth0, depth0.items, {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data}); if(stack1 || stack1 === 0) { return stack1; } else { return ''; } - }); - + }); + this["Handlebars"]["templates"]["environment_selector_actions"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) { this.compilerInfo = [4,'>= 1.0.0']; helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; @@ -129,8 +129,8 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; return "
  • No environment
  • \n
  • \n
  • Manage environments
  • "; - }); - + }); + this["Handlebars"]["templates"]["header_preset_list"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) { this.compilerInfo = [4,'>= 1.0.0']; helpers = this.merge(helpers, Handlebars.helpers); partials = this.merge(partials, Handlebars.partials); data = data || {}; @@ -149,8 +149,8 @@ function program1(depth0,data) { stack1 = helpers.each.call(depth0, depth0.items, {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data}); if(stack1 || stack1 === 0) { return stack1; } else { return ''; } - }); - + }); + this["Handlebars"]["templates"]["history_sidebar_requests"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) { this.compilerInfo = [4,'>= 1.0.0']; helpers = this.merge(helpers, Handlebars.helpers); partials = this.merge(partials, Handlebars.partials); data = data || {}; @@ -169,8 +169,8 @@ function program1(depth0,data) { stack1 = helpers.each.call(depth0, depth0.items, {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data}); if(stack1 || stack1 === 0) { return stack1; } else { return ''; } - }); - + }); + this["Handlebars"]["templates"]["item_broadcast"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) { this.compilerInfo = [4,'>= 1.0.0']; helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; @@ -183,8 +183,8 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; if(stack1 || stack1 === 0) { buffer += stack1; } buffer += "\n"; return buffer; - }); - + }); + this["Handlebars"]["templates"]["item_collection_selector_list"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) { this.compilerInfo = [4,'>= 1.0.0']; helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; @@ -201,8 +201,8 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; buffer += escapeExpression(stack1) + ""; return buffer; - }); - + }); + this["Handlebars"]["templates"]["item_collection_sidebar_head"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) { this.compilerInfo = [4,'>= 1.0.0']; helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; @@ -251,8 +251,8 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; buffer += escapeExpression(stack1) + "\" class=\"sidebar-collection-requests\">\n\n"; return buffer; - }); - + }); + this["Handlebars"]["templates"]["item_collection_sidebar_request"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) { this.compilerInfo = [4,'>= 1.0.0']; helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; @@ -289,8 +289,8 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; if(stack1 || stack1 === 0) { buffer += stack1; } buffer += "\n \n \n \n "; return buffer; - }); - + }); + this["Handlebars"]["templates"]["item_editor_standard"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) { this.compilerInfo = [4,'>= 1.0.0']; helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; @@ -298,8 +298,8 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; return buffer; - }); - + }); + this["Handlebars"]["templates"]["item_environment_list"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) { this.compilerInfo = [4,'>= 1.0.0']; helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; @@ -332,8 +332,8 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; buffer += escapeExpression(stack1) + "\">\n \n \n\n"; return buffer; - }); - + }); + this["Handlebars"]["templates"]["item_environment_quicklook"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) { this.compilerInfo = [4,'>= 1.0.0']; helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; @@ -350,8 +350,8 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; buffer += escapeExpression(stack1) + "\n\n"; return buffer; - }); - + }); + this["Handlebars"]["templates"]["item_environment_selector"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) { this.compilerInfo = [4,'>= 1.0.0']; helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; @@ -368,8 +368,8 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; buffer += escapeExpression(stack1) + "\n"; return buffer; - }); - + }); + this["Handlebars"]["templates"]["item_header_preset_list"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) { this.compilerInfo = [4,'>= 1.0.0']; helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; @@ -394,8 +394,8 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; buffer += escapeExpression(stack1) + "\">\n \n \n\n"; return buffer; - }); - + }); + this["Handlebars"]["templates"]["item_history_sidebar_request"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) { this.compilerInfo = [4,'>= 1.0.0']; helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; @@ -432,8 +432,8 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; if(stack1 || stack1 === 0) { buffer += stack1; } buffer += "\n \n \n \n"; return buffer; - }); - + }); + this["Handlebars"]["templates"]["item_response_code"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) { this.compilerInfo = [4,'>= 1.0.0']; helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; @@ -462,8 +462,8 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; buffer += escapeExpression(stack1) + "\n\n"; return buffer; - }); - + }); + this["Handlebars"]["templates"]["item_response_cookie"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) { this.compilerInfo = [4,'>= 1.0.0']; helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; @@ -500,13 +500,33 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; buffer += escapeExpression(stack1) + "\n\n"; return buffer; - }); - + }); + this["Handlebars"]["templates"]["item_response_header"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) { this.compilerInfo = [4,'>= 1.0.0']; helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; - var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression; + var buffer = "", stack1, helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, functionType="function", self=this; +function program1(depth0,data) { + + var buffer = "", stack1, options; + buffer += "\n "; + options = {hash:{},data:data}; + buffer += escapeExpression(((stack1 = helpers.link_to_hyperlink || depth0.link_to_hyperlink),stack1 ? stack1.call(depth0, depth0.value, options) : helperMissing.call(depth0, "link_to_hyperlink", depth0.value, options))) + + "\n "; + return buffer; + } + +function program3(depth0,data) { + + var buffer = "", stack1; + buffer += "\n "; + if (stack1 = helpers.value) { stack1 = stack1.call(depth0, {hash:{},data:data}); } + else { stack1 = depth0.value; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } + buffer += escapeExpression(stack1) + + "\n "; + return buffer; + } buffer += "
  • \n
    \n
    "; - if (stack1 = helpers.value) { stack1 = stack1.call(depth0, {hash:{},data:data}); } - else { stack1 = depth0.value; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } - buffer += escapeExpression(stack1) - + "
    \n
  • "; + + " →\n
    \n "; + stack1 = helpers['if'].call(depth0, depth0.isLink, {hash:{},inverse:self.program(3, program3, data),fn:self.program(1, program1, data),data:data}); + if(stack1 || stack1 === 0) { buffer += stack1; } + buffer += "\n
    \n"; return buffer; - }); - + }); + this["Handlebars"]["templates"]["item_sample_response"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) { this.compilerInfo = [4,'>= 1.0.0']; helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; @@ -552,8 +571,8 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; buffer += escapeExpression(stack1) + "\">Remove\n \n"; return buffer; - }); - + }); + this["Handlebars"]["templates"]["message_collection_added"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) { this.compilerInfo = [4,'>= 1.0.0']; helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; @@ -570,8 +589,8 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; buffer += escapeExpression(stack1) + ".\n"; return buffer; - }); - + }); + this["Handlebars"]["templates"]["message_environment_added"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) { this.compilerInfo = [4,'>= 1.0.0']; helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; @@ -588,8 +607,8 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; buffer += escapeExpression(stack1) + ".\n"; return buffer; - }); - + }); + this["Handlebars"]["templates"]["message_no_collection"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) { this.compilerInfo = [4,'>= 1.0.0']; helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; @@ -597,8 +616,8 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; return "
    \n You haven't created any collections yet. Collections let you group requests together for quick access.\n
    "; - }); - + }); + this["Handlebars"]["templates"]["message_no_history"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) { this.compilerInfo = [4,'>= 1.0.0']; helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; @@ -606,8 +625,8 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; return "
    \n Nothing in your history yet. You can automatically save and access your sent requests here.\n
    "; - }); - + }); + this["Handlebars"]["templates"]["response_cookies"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) { this.compilerInfo = [4,'>= 1.0.0']; helpers = this.merge(helpers, Handlebars.helpers); partials = this.merge(partials, Handlebars.partials); data = data || {}; @@ -626,8 +645,8 @@ function program1(depth0,data) { stack1 = helpers.each.call(depth0, depth0.items, {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data}); if(stack1 || stack1 === 0) { return stack1; } else { return ''; } - }); - + }); + this["Handlebars"]["templates"]["response_headers"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) { this.compilerInfo = [4,'>= 1.0.0']; helpers = this.merge(helpers, Handlebars.helpers); partials = this.merge(partials, Handlebars.partials); data = data || {}; @@ -646,8 +665,8 @@ function program1(depth0,data) { stack1 = helpers.each.call(depth0, depth0.items, {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data}); if(stack1 || stack1 === 0) { return stack1; } else { return ''; } - }); - + }); + this["Handlebars"]["templates"]["sample_responses"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) { this.compilerInfo = [4,'>= 1.0.0']; helpers = this.merge(helpers, Handlebars.helpers); partials = this.merge(partials, Handlebars.partials); data = data || {}; diff --git a/chrome/js/templates/item_response_header.handlebars b/chrome/js/templates/item_response_header.handlebars index e3c112cd..64719cf3 100644 --- a/chrome/js/templates/item_response_header.handlebars +++ b/chrome/js/templates/item_response_header.handlebars @@ -3,5 +3,11 @@ data-content="{{description}}" data-trigger="hover" rel="popover">{{name}} → -
    {{value}}
    +
    + {{#if isLink}} + {{link_to_hyperlink value}} + {{else}} + {{value}} + {{/if}} +
    \ No newline at end of file