forked from external-repos/pa11y-dashboard
Parse task headers as HTTP headers rather than JSON
This commit is contained in:

committed by
Rowan Manning

parent
ee729d1d55
commit
568e068613
@@ -105,8 +105,9 @@ along with Pa11y Dashboard. If not, see <http://www.gnu.org/licenses/>.
|
||||
<div class="form-group clearfix">
|
||||
<div class="row">
|
||||
<div class="col-md-4 col-sm-4 col-xs-6">
|
||||
<label class="control-label" for="new-task-headers">Headers Object (JSON)</label>
|
||||
<input class="form-control" id="new-task-headers" type="text" name="headers" value="{{task.headers}}" placeholder='{"Cookie": "foo=bar"}'/>
|
||||
<label class="control-label" for="new-task-headers">HTTP Headers</label>
|
||||
<textarea class="form-control" id="new-task-headers" name="headers" placeholder="Cookie: foo=bar">{{task.headers}}</textarea>
|
||||
<em>(As key/value pairs, separated by newlines/colons)</em>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -35,6 +35,13 @@ function presentTask(task) {
|
||||
// Enhance the ignored rules
|
||||
task.ignore = presentIgnoreRules(task.ignore);
|
||||
|
||||
// Change headers to a string format
|
||||
if (task.headers && typeof task.headers === 'object') {
|
||||
task.headers = Object.keys(task.headers).map(header => {
|
||||
return `${header}: ${task.headers[header]}`;
|
||||
}).join('\n');
|
||||
}
|
||||
|
||||
// Present the last result if present
|
||||
if (task.last_result) {
|
||||
task.lastResult = presentResult(task.last_result);
|
||||
|
@@ -117,8 +117,9 @@ along with Pa11y Dashboard. If not, see <http://www.gnu.org/licenses/>.
|
||||
<div class="form-group clearfix">
|
||||
<div class="row">
|
||||
<div class="col-md-4 col-sm-4 col-xs-6">
|
||||
<label class="control-label" for="new-task-headers">Headers Object (JSON)</label>
|
||||
<input class="form-control" id="new-task-headers" type="text" name="headers" value="{{task.headers}}" placeholder='{"Cookie": "foo=bar"}'/>
|
||||
<label class="control-label" for="new-task-headers">HTTP Headers</label>
|
||||
<textarea class="form-control" id="new-task-headers" name="headers" placeholder="Cookie: foo=bar">{{task.headers}}</textarea>
|
||||
<em>(As key/value pairs, separated by newlines/colons)</em>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user