Multipart with excel file upload for PUT is giving 400

129 views
Skip to first unread message

sushmitha

unread,
May 24, 2021, 9:51:01 AM5/24/21
to REST assured
Hi everyone,
when i tried to upload the .xlsx file getting the response as 400. Can somebody please help

RestAssured.baseURI =";
RestAssured.basePath="";

RequestSpecification request = RestAssured.given();
request.header("ContentType","multipart/form-data");
request.header("Authorization", "Bearer" + accessToken);
request.multiPart(file1).log().all();
Response response = request.put();

Johan Haleby

unread,
May 24, 2021, 9:53:52 AM5/24/21
to rest-a...@googlegroups.com
Can you provide more details of the response? What errors do you get from the server? (you can do "log().all()" after put() to see this)

--
You received this message because you are subscribed to the Google Groups "REST assured" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rest-assured...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rest-assured/80d7671e-40d0-4b27-a48d-15c035bec9b0n%40googlegroups.com.

sushmitha

unread,
May 24, 2021, 10:41:05 AM5/24/21
to REST assured
Request method: PUT
Request URI:
Proxy: <none>
Request params: <none>
Query params: <none>
Form params: <none>
Path params: <none>
Multiparts: controlName=file, mimeType=application/octet-stream, charset=<none>, fileName=incompleDownload.xlsx, content=D:\QAAutomation\AdminPanel\Upload\finops-automation\Documents\AdminPanel\incompleDownload.xlsx
Headers: Authorization=Bearer token
Accept=*/*
Content-Type=multipart/form-data
Cookies: <none>
Body: <none>
HTTP/1.1 400 
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Content-Type: application/json;charset=UTF-8
Date: Mon, 24 May 2021 14:39:52 GMT
Expires: 0
Pragma: no-cache
Server: nginx
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
X-XSS-Protection: 1; mode=block
Content-Length: 62
Connection: keep-alive

{
    "responseCode": "400",
    "responseMsg": "Failed to process file."
}
400
{"responseCode":"400","responseMsg":"Failed to process file."}

Ravi Ranjan

unread,
May 25, 2021, 4:47:22 AM5/25/21
to rest-a...@googlegroups.com
use in the way:


response = request.contentType("application/json").accept("*/*").body(requestList).put(ENDPOINT_GET_USER_BY_ID);



--
Thanks & Regards,
Ravi Ranjan Pandey
Reply all
Reply to author
Forward
0 new messages