diff --git a/Resources/views/layout.html.twig b/Resources/views/layout.html.twig index 5e170a007..be42d08dd 100644 --- a/Resources/views/layout.html.twig +++ b/Resources/views/layout.html.twig @@ -385,8 +385,10 @@ method = $('[name="header_method"]', this).val(), self = this, params = {}, + filters = {}, formData = new FormData(), doubledParams = {}, + doubledFilters = {}, headers = {}, content = $(this).find('textarea.content').val(), result_container = $('.result', $(this).parent()); @@ -471,6 +473,26 @@ + // retrieve all the filters to send + $('.parameters .tuple .filter', $(this)).each(function() { + var key, value; + + key = $('.key', $(this)).val(); + value = $('.value', $(this)).val(); + + if (value) { + // temporary save all additional/doubled parameters + if (key in filters) { + doubledFilters[key] = value; + } else { + filters[key] = value; + } + } + }); + + + + // retrieve the additional headers to send $('.headers .tuple', $(this)).each(function() { var key, value; @@ -519,6 +541,18 @@ } {% endif %} + //add filters as GET params and remove them from params + if(method != 'GET'){ + for (var filterKey in $.extend({}, filters)){ + url += url.indexOf('?') > 0 ? '&' : '?'; + url += filterKey + '=' + filters[filterKey]; + + if (params.hasOwnProperty(filterKey)){ + delete(params[filterKey]); + } + } + } + // prepare final parameters var body = {}; if(bodyFormat == 'json' && method != 'GET') { diff --git a/Resources/views/method.html.twig b/Resources/views/method.html.twig index 87a85ca6d..6ea5f3c2c 100644 --- a/Resources/views/method.html.twig +++ b/Resources/views/method.html.twig @@ -217,7 +217,7 @@ {% if data.filters is defined %}

Filters

{% for name, infos in data.filters %} -

+

= -