service:
public interface ImageService { @Post("api/v1/attachment") Call<BaseResponse> delete(@Body DeleteModel deleteModel); }
and in servercontroller
import okhttp3.Request; private final class ApiInterceptor implements Interceptor { @Override public Response intercept(Chain chain) throws IOException { Request oldRequest = chain.request(); Request.Builder builder = oldRequest.newBuilder(); if(condition) { return chain.proceed(builder.build().newBuilder().delete(builder.build().body()).build()); } return chain.proceed(builder.build()); } }
you need to call a condition, through something and you may have to do some filtering for url / header / body in order to remove the trigger,
if the header delete url / body / is not unique, so as not to interfere with the message or receive requests.
source share