gpt4 book ai didi

android - 如何在同一 api 调用中使用 @part 和 @field 进行改造

转载 作者:行者123 更新时间:2023-11-29 00:04:46 26 4
gpt4 key购买 nike

@Multipart
@FormUrlEncoded
@POST("/upload")
void uploadImage(@Field("title") String title, @Field("description") String description, @Part("file") TypedFile photoFile, Callback<ImageVotingResponse> responseCallback);

我有这个 api 调用,但我无法同时使用 @Multipart 和 @FormUrlEncoded。它给我错误,如“只允许一个编码注释”。有什么解决办法吗?

最佳答案

使用注解@Multipart,将@Field注解改为@Query注解。

来自 postman 文档

urlencoded

This encoding is the same as the one used in URL parameters. You just need to enter key/value pairs and Postman will encode the keys and values properly. Note that you can not upload files through this encoding mode. There might be some confusion between form-data and urlencoded so make sure to check with your API first.

关于android - 如何在同一 api 调用中使用 @part 和 @field 进行改造,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34690580/

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