0

I have multiple requests that repeate same form data fields, Is there any way to add these fields once in an interceptor or something else.

How my requests looks like

@FormUrlEncoded
@POST("endpointone")
Call<ResponseOne> requestRemoveFromCart(@Field("myParamOne") int myParamOne,
                                        @Field("repeatingParamOne") int repeatingParamOne,
                                        @Field("repeatingParamTwo") int repeatingParamTwo);


@FormUrlEncoded
@POST("endpointtwo")
Call<ResponseTwo> requestSetQty(@Field("myParamTwo") int myParamTwo
                                @Field("repeatingParamOne") int repeatingParamOne,
                                @Field("repeatingParamTwo") int repeatingParamTwo);

Now, I don't want to add repeatingParamOne and repeatingParamTwo in every single request, is there any way where I can add it once.

Note : I know we can add query parameters in interceptor but my question is weather we can also form data field or not?

Thanks in advance!

Shayan Samad
  • 294
  • 1
  • 10

0 Answers0