休息确保POST调用会引发org.apache.http.NoHttpResponseException

时间:2018-10-15 13:09:17

标签: java rest api automated-tests rest-assured

Rest Assured POST调用引发org.apache.http.NoHttpResponseException:无法响应。相同的网址可用于GET调用,但只有POST调用抛出以下错误。我已经尝试过

  • RestAssured.config()。sslConfig(new SSLConfig()。allowAllHostnames());

  • 设置代理配置

  • 进入 {{3}}

    但是问题仍然没有解决。

  

org.apache.http.NoHttpResponseException servername:port无法响应   在org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:143)     在   org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:57)     在   org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:261)     在   org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader(AbstractHttpClientConnection.java:283)

print (temp_df.columns.tolist())
['Type1', 'Type2', 'Type3', 'Type4', 'Type5', 'col', 'F']

放心的日志消息:

        RestAssured.baseURI = url;
        RestAssured.useRelaxedHTTPSValidation();
        RequestSpecification request = RestAssured.given().log().all();
        RestAssured.config().sslConfig(new SSLConfig().allowAllHostnames());

        request.formParams(params);
        request.headers(headers);
        request.body(body);
        Response resp = request.post();
        System.out.println("Response data is =>  " + resp.asString());

0 个答案:

没有答案