I\'m attempting to use an HttpDelete object to invoke a web service\'s delete method. The web service\'s code parses JSON from the message\'s body. However, I\'m failing t
in retrofit
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 have to trigger condition, via something and potentially have to do some filtering for the url/header/body to remove the trigger,
unless the delete url/body/header is unique enough to not collide with post or get requests.