-
Notifications
You must be signed in to change notification settings - Fork 206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
111 fixed, updated OkHttp 3.2.0->3.9.0 #236
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package com.artemzin.qualitymatters.network; | ||
|
||
import android.support.annotation.NonNull; | ||
import android.support.annotation.Nullable; | ||
import okhttp3.HttpUrl; | ||
import okhttp3.Interceptor; | ||
import okhttp3.Request; | ||
|
||
import java.io.IOException; | ||
import java.net.URI; | ||
|
||
/** | ||
* An interceptor that allows runtime changes to the URL hostname. | ||
* As per https://gist.github.com/swankjesse/8571a8207a5815cca1fb | ||
*/ | ||
public final class HostSelectionInterceptor implements Interceptor { | ||
/** | ||
* Using static variable in order to avoid adding this interceptor to ApplicationComponent | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This comment seems to be out of sync with code |
||
*/ | ||
private volatile String host; | ||
|
||
public void setHost(@Nullable String host) { | ||
this.host = host; | ||
} | ||
|
||
@Override | ||
public okhttp3.Response intercept(@NonNull Chain chain) throws IOException { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. import Response? |
||
Request request = chain.request(); | ||
String host = this.host; | ||
if (host != null) { | ||
URI uri = URI.create(host); | ||
HttpUrl newUrl = request.url().newBuilder() | ||
.host(uri.getHost()) | ||
.port(uri.getPort()) | ||
.scheme("http") //in order to avoid SSL Handshake failure | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. wow wow, this is pretty dangerous code in case if someone will copy-paste it and use to switch to lets say "staging/prod" environment in the app I'd prefer to store schema in base url that we want to swap to, maybe use |
||
.build(); | ||
request = request.newBuilder() | ||
.url(newUrl) | ||
.build(); | ||
} | ||
return chain.proceed(request); | ||
} | ||
} |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# OkHttp3 | ||
-dontwarn okhttp3.** | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we'll need more rules. there's one more for the publicsuffixdatabase thing. they've got it documented. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is that the proper indentation for this project?