Retrofit 的 PATCH 传参

2023-02-15  本文已影响0人  逆水寒Stephen

这次有个接口是patch格式的,查个好些文档都没几个说得很清楚怎么设置参数,这次尝试后记录下来哈,如有不对请指出

@PATCH("/api/test")
fun testApi(
    @Body paramStr: String
): Observable<NetBaseResponse<String>>

2).多参数

@PATCH("/api/test")
fun testApi(
    @Body paramMap: Map<String, String>
): Observable<NetBaseResponse<String>>
@FormUrlEncoded
@PATCH("/api/test")
fun testApi(
    @Field("param0") param0: String?,
    @Field("param1") param1: String? = "app",
    @Field("param2") param2: String? = "APP",
): Observable<NetBaseResponse<String>>

希望对大家有些许帮助,Have Nice Day!

上一篇 下一篇

猜你喜欢

热点阅读