使用正文,查询参数和身份验证代码发布请求

时间:2019-09-27 10:10:06

标签: rest-assured rest-assured-jsonpath

我想发布一个包含 查询参数作为键-<div class="row top-space-30"> <form class="needs-validation" novalidate action="" method=""> <div class="form-group row"> <label class="col-md-4 col-form-label text-md-right" for="studentname">Student Name:</label> <div class="col-md-6"> <input id="role" name="studentname" type="text" placeholder="name" class="form-control input-md" required> <div class="valid-feedback">Valid.</div> <div class="invalid-feedback">Please fill out this field.</div> </div> </div> <div class="form-group row"> <label class="col-md-4 col-form-label text-md-right" for="department">Department:</label> <div class="col-md-8"> <input class="form-control" type="text" id="department"> <input type="hidden" id="TestHidden" value="{{result}}" required> </div> </div> <div class="col-md-6 offset-md-4 top-space-30"> <button type="submit" id="submit">Submit</button> </div> </form> </div> </div> <script> // Disable form submissions if there are invalid fields (function () { 'use strict'; window.addEventListener('load', function () { // Get the forms we want to add validation styles to var forms = document.getElementsByClassName('needs-validation'); // Loop over them and prevent submission var validation = Array.prototype.filter.call(forms, function (form) { form.addEventListener('submit', function (event) { if (form.checkValidity() === false) { event.preventDefault(); event.stopPropagation(); } form.classList.add('was-validated'); }, false); }); }, false); })(); $("#submit").click(function (e) { var studentName = $("#role").val(); var departmentsList = $("#department").val().split(','); $.ajax({ type: 'POST', url: '/students/add', data: { 'role': studentName, 'departmentslist': JSON.stringify(departmentsList) }, success: function (result) { alert("The department has been added"); document.location.href = "/department"; } }) }) </script> 和值-httpVerbdelete-authentication codebearer token-body

{"authorizationUrl":"/projects/464"}access_token是全局全局变量。

base_url

0 个答案:

没有答案