uLY*_*eus 9 android http retrofit
所以我实际上是在尝试使用TypedByteArray作为我的身体进行PUT.我正在与Azure服务器进行交互,因此第一步是
使用我的图像元数据进行POST调用,然后返回一个URL(例如URL_PUT)
我必须向该URL_PUT发出PUT请求(从步骤1开始),所以我的改进单例接口函数如下所示:
public interface ImageInterface {
@PUT("/{nothing}")
Response uploadBlob(@Body TypedByteArray byteArray,
@Header("Content-Length") String byteArrayLength,
@Path(value="nothing",encode=false) String nothing);
}
Run Code Online (Sandbox Code Playgroud)
但我得到一个错误,说当我通过""时,URL路径必须以"/"开头.对于上面的函数我尝试传递一个空字符串,但无济于事.
所以基本上我只想使用端点进行改造,但PUT没有路径/ balnk路径.有没有办法做到这一点?
拆分 URL_PUT 怎么样?
例如,您有http://example.com/path/more/path/image.jpg
您将其分成 2 个字符串: - http://example.com - /path/more/path/image.jpg
然后你去掉第二个搅拌的第一个“/”。然后与您类似:
public interface ImageInterface {
@PUT("/{second-string}")
Response uploadBlob(@Body TypedByteArray byteArray,
@Header("Content-Length") String byteArrayLength,
@Path(value="second-string",encode=false) String secondString);
}
Run Code Online (Sandbox Code Playgroud)
然后在您的客户端上使用此接口的字符串 1。并将字符串 2 作为参数发送。我想这应该可行。
(抱歉,我打字太快了,我正在路上)
| 归档时间: |
|
| 查看次数: |
1478 次 |
| 最近记录: |