uploadcare / uploadcare-java

Java API client that handles uploads and further operations with files by wrapping Uploadcare Upload and REST APIs.
https://uploadcare.com
Apache License 2.0
6 stars 13 forks source link

Using UC3.2.0, the part-based upload triggers an invalid request error #19

Closed Arteneko closed 4 years ago

Arteneko commented 5 years ago

The triggered exception is com.uploadcare.exceptions.UploadcareInvalidRequestException: Request does not contain files

My guess is that the code is missing a file-field declaration.

dmitry-mukhin commented 5 years ago

Can you provide stacktrace and steps to reproduce the issue?

Arteneko commented 5 years ago

Stack-trace

[qtp1300801804-17] ERROR spark.http.matching.GeneralError - 
com.uploadcare.exceptions.UploadcareInvalidRequestException: Request does not contain files.
    at com.uploadcare.api.RequestHelper.checkResponseStatus(RequestHelper.java:249)
    at com.uploadcare.api.RequestHelper.executeQuery(RequestHelper.java:124)
    at com.uploadcare.upload.FileUploader.upload(FileUploader.java:95)
    at org.artemix.laurasgallery.api.uploadcare.Uploadcare.upload(Uploadcare.java:26)

Steps to reproduce

Use the following method, passing an InputStream.

In the trigger context, the InputStream was obtained from a SparkJava Request part object (see second snippet below).

public UUID upload(InputStream stream, String filename) throws UploadFailureException {
    Uploader uploader = new FileUploader(client, stream, filename);
    return UUID.fromString(uploader.upload().save().getFileId());
}
Part imageFile = req.raw().getPart("image");
baileyatwork commented 4 years ago

I'm running into this exact issue. Any updates?

rsedykh commented 4 years ago

Hi @baileyatwork. We're planning to update Java client before mid-summer. All issues will be fixed and the latest API version will be supported!

rsedykh commented 4 years ago

@baileyatwork actually, we'll take a look into it in a few days!

baileyatwork commented 4 years ago

👍 Thanks, @rsedykh.

raphaelnew commented 4 years ago

@baileyatwork library has been updated to v3.3.0. This issue should be fixed.