我正在使用 HttpClient fluent api 编写验收测试并且遇到了一些麻烦。
@When("^I submit delivery address and delivery time$")
public void I_submit_delivery_address_and_delivery_time() throws Throwable {
Response response = Request
.Post("http://localhost:9999/food2go/booking/placeOrder")
.bodyForm(
param("deliveryAddressStreet1",
deliveryAddress.getStreet1()),
param("deliveryAddressStreet2",
deliveryAddress.getStreet2()),
param("deliveryTime", deliveryTime)).execute();
content = response.returnContent();
log.debug(content.toString());
}
当我使用 post-forward 策略时,这段代码运行良好,但是当我使用重定向时抛出异常。
org.apache.http.client.HttpResponseException: Found
我想要的是获取重定向页面的内容。任何想法都值得赞赏,在此先感谢。