我从邮递员那里获得了不同的结果并且放心,使用相同的端点和请求

时间:2017-01-05 19:42:02

标签: rest postman rest-assured

虽然从邮递员,它总是成功并返回json对象,但从放心,它返回的html页面。有什么我可以做的吗?我正在使用testNG和theses静态导入apis:io.restassured.RestAssured。* io.restassured.matcher.RestAssuredMatchers。* org.hamcrest.Matchers。*

1 个答案:

答案 0 :(得分:0)

确保RestAssured正在添加适当的<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/> <div class="container" > <div id="row" class="row" > <div id="form1" class="col-xs-6"> <!-- form1 --> <form class="form-horizontal"> <div class="form-group"> <label class="control-label col-xs-2" for="email">Email:</label> <div class="col-xs-10"> <input type="email" class="form-control" id="email" placeholder="Enter email"> </div> </div> <div class="form-group"> <label class="control-label col-xs-2" for="pwd">Password:</label> <div class="col-xs-10"> <input type="password" class="form-control" id="pwd" placeholder="Enter password"> </div> </div> <div class="form-group"> <div class="col-xs-offset-2 col-xs-10"> <div class="checkbox"> <label><input type="checkbox"> Remember me</label> </div> </div> </div> <div class="form-group"> <div class="col-xs-offset-2 col-xs-10"> <button type="submit" class="btn btn-default">Submit</button> </div> </div> </form> </div> <div id="form2" class="col-xs-6"> <!-- form 2 --> <form class="form-horizontal"> <div class="form-group"> <label class="control-label col-xs-2" for="email">Email:</label> <div class="col-xs-10"> <input type="email" class="form-control" id="email" placeholder="Enter email"> </div> </div> <div class="form-group"> <label class="control-label col-xs-2" for="pwd">Password:</label> <div class="col-xs-10"> <input type="password" class="form-control" id="pwd" placeholder="Enter password"> </div> </div> <div class="form-group"> <div class="col-xs-offset-2 col-xs-10"> <div class="checkbox"> <label><input type="checkbox"> Remember me</label> </div> </div> </div> <div class="form-group"> <div class="col-xs-offset-2 col-xs-10"> <button type="submit" class="btn btn-default">Submit</button> </div> </div> </form> </div> </div> </div>标头,如下所示:

Accept

这是内容协商的一部分。

https://developer.mozilla.org/en-US/docs/Web/HTTP/Content_negotiation

有一个很好的概述。