How to specify a default user agent for okhttp 2.x requests

You can use an interceptor to add the User-Agent header to all your requests. For more information about okHttp interceptors see http://square.github.io/okhttp/interceptors/ Example implementation of this interceptor: /* This interceptor adds a custom User-Agent. */ public class UserAgentInterceptor implements Interceptor { private final String userAgent; public UserAgentInterceptor(String userAgent) { this.userAgent = userAgent; } @Override public … Read more

How can I handle empty response body with Retrofit 2?

Edit: As Jake Wharton points out, @GET(“/path/to/get”) Call<Void> getMyData(/* your args here */); is the best way to go versus my original response — You can just return a ResponseBody, which will bypass parsing the response. @GET(“/path/to/get”) Call<ResponseBody> getMyData(/* your args here */); Then in your call, Call<ResponseBody> dataCall = myApi.getMyData(); dataCall.enqueue(new Callback<ResponseBody>() { @Override … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)