Issue
I have been tyring to execute API has two parameters as I said in title here is my API configure
//region SignUp
String SIGN_UP_USER = "User/SignUp";
@POST(SIGN_UP_USER)
@Multipart
@Headers("Content-Type: application/json")
Call<SignUpResponse> signUp(
@Part MultipartBody.Part profilePicture,
@Query("email") String email,
@Query("password") String password,
@Query("firstName") String firstName,
@Query("lastName") String lastName);
//endregion
But when I execute the request I got this error:
java.lang.IllegalStateException: Multipart body must have at least one part.
And here is the details of request from Swagger
Any suggestions for this issue,
Thanks in advance
Solution
All what I did to fix my problem was remove this Annotation
@Headers("Content-Type: application/json")
from my code and request.
and for sending empty files you can just send a null parameter for file will take it as empty.
Answered By - mustafa hasria
Answer Checked By - Mary Flores (JavaFixing Volunteer)