Retrofit: How to send a POST request with constant fields?

后端 未结 4 1297
旧时难觅i
旧时难觅i 2021-02-19 09:29

I want to sent a simple POST request with one actual parameter:

@POST(\"/token\")
@FormUrlEncoded
void extendSession(@Field(\"refresh_token\")final String refres         


        
4条回答
  •  不思量自难忘°
    2021-02-19 10:19

    Instead of a String, your interface could accept a GrantType object which has factory methods for different grant_types. These factory methods would set the client_id, client_secret, and grant_type fields.

    @POST("/oauth/token")
    Call extendSession(@Body GrantType grantType);
    

提交回复
热议问题