[英]how to use multi part file attachment using Rest-assured in Java?
I am trying to execute post request using rest-assured with multipart/form-data, the request contains with a url with parameters and file to be attached 我正在尝试使用带有multipart / form-data的保证来执行发布请求,该请求包含带有URL的参数和要附加的文件
Below is the code which I am trying and getting handshake error how can I attach a file with url ? 以下是我正在尝试并遇到握手错误的代码,如何附加带有url的文件?
RequestSpecification httpRequest = RestAssured
.given()
.relaxedHTTPSValidation()
.cookie("SESSION", cookieVal)
.header("Content-Type", "multipart/form-data")
.header("accept","application/json")
.multiPart(new File("CorporateWallpaper.jpg")) ;
Response response = httpRequest.request().post(url);
System.out.print(response.getStatusCode());
Actual result 实际结果
javax.net.ssl.SSLHandshakeException: Remote host terminated the handshake
at java.base/sun.security.ssl.SSLSocketImpl.handleEOF(SSLSocketImpl.java:1321)
at java.base/sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1160)
at java.base/sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1063)
at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:402)
at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:533)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.