gpt4 book ai didi

Android:没有 "/"的改造URL路径

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:43:30 24 4
gpt4 key购买 nike

所以我实际上是在尝试使用 TypedByteArray 作为主体来执行 PUT。我正在与 Azure 服务器交互,所以第一步是

  1. 使用我的图像元数据进行 POST 调用,我得到一个 URL(比如 URL_PUT)

  2. 我必须向该 URL_PUT 发出 PUT 请求(从第 1 步开始),因此我的改造单例接口(interface)函数如下所示:

    public interface ImageInterface {

@PUT("/{nothing}")
Response uploadBlob(@Body TypedByteArray byteArray,
@Header("Content-Length") String byteArrayLength,
@Path(value="nothing",encode=false) String nothing);

}

但是我得到一个错误,说 URL 路径必须以“/”开头,当我没有传递“”时。对于上面的函数,我尝试传递一个空字符串,但没有用。

所以基本上我只想使用带有端点的改造,但没有用于 PUT 的路径/平衡路径。有什么办法吗?

最佳答案

拆分 URL_PUT 怎么样?

例如,您有 http://example.com/path/more/path/image.jpg

你把它分成 2 个字符串:- http//example.com-/path/more/path/image.jpg

然后你去掉第 2 个 Stirng 的第一个“/”。然后像你一样:

public interface ImageInterface {

@PUT("/{second-string}")
Response uploadBlob(@Body TypedByteArray byteArray,
@Header("Content-Length") String byteArrayLength,
@Path(value="second-string",encode=false) String secondString);

}

然后在您的客户端上使用带有此接口(interface)的字符串 1。并将字符串 2 作为参数发送。我想这应该可行。

(对不起,我打得太快了,我在路上)

关于Android:没有 "/"的改造URL路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26832614/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com