square / retrofit

A type-safe HTTP client for Android and the JVM
https://square.github.io/retrofit/
Apache License 2.0
43.11k stars 7.3k forks source link

I got this exception when I upload a file #2402

Closed zhpanvip closed 7 years ago

zhpanvip commented 7 years ago

java.lang.IllegalArgumentException: Invalid % sequence at 432: --8c46470b-77e7-4dd8-b4e5-55f6968db182 Content-Disposition: form-data; name="phone" Content-Length: 11

1551526 --8c46470b-77e7-4dd8-b4e5-55f6968db182 Content-Disposition: form-data; name="password" Content-Length: 6

123123 --8c46470b-77e7-4dd8-b4e5-55f6968db182 Content-Disposition: form-data; name="uploadFile"; filename="test.txt" Content-Type: multipart/form-data Content-Length: 27

2ggxghgggg(dhdhdhdjjdjd %

--8c46470b-77e7-4dd8-b4e5-55f6968db182--

swankjesse commented 7 years ago

Executable test case?

zhpanvip commented 7 years ago

I have solved this problem.It's cause of HttpLoggingInterceptor.when Because I setLevel with BODY ,like this "loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BODY);" But when I setLevel With Headers,It works .