Display select to choose http method in sandbox

This commit is contained in:
Jeremy Perret 2014-10-26 12:28:50 +01:00
parent 4beb08e587
commit e7d3c803bb
2 changed files with 14 additions and 4 deletions

View File

@ -366,7 +366,7 @@
$('.pane.sandbox form').submit(function() {
var url = $(this).attr('action'),
method = $(this).attr('method'),
method = $('[name="header_method"]', this).val(),
self = this,
params = {},
formData = new FormData(),
@ -377,8 +377,6 @@
if (method === 'ANY') {
method = 'POST';
} else if (method.indexOf('|') !== -1) {
method = method.split('|').sort().pop();
}
// set requestFormat

View File

@ -201,7 +201,7 @@
{% if app.request is not null and data.https and app.request.secure != data.https %}
Please reload the documentation using the scheme {% if data.https %}HTTPS{% else %}HTTP{% endif %} if you want to use the sandbox.
{% else %}
<form method="{{ data.method|upper }}" action="{% if data.host is defined %}{{ data.https ? 'https://' : 'http://' }}{{ data.host }}{% endif %}{{ data.uri }}">
<form method="" action="{% if data.host is defined %}{{ data.https ? 'https://' : 'http://' }}{{ data.host }}{% endif %}{{ data.uri }}">
<fieldset class="parameters">
<legend>Input</legend>
{% if data.requirements is defined %}
@ -247,6 +247,18 @@
</fieldset>
<fieldset class="headers">
{% set methods = data.method|upper|split('|') %}
{% if methods|length > 1 %}
<legend>Method</legend>
<select name="header_method">
{% for method in methods %}
<option value="{{ method }}">{{ method }}</option>
{% endfor %}
</select>
{% else %}
<input type="hidden" name="header_method" value="{{ methods|join }}" />
{% endif %}
<legend>Headers</legend>
{% if acceptType %}