diff options
author | Allan Wang <me@allanwang.ca> | 2018-04-13 00:13:28 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-13 00:13:28 -0400 |
commit | c5e769deabeb80d7257b85c5c3d802cf46e6b191 (patch) | |
tree | b3ac48678e893495b932c6500025db73a83e3d2b /app/src/main/kotlin/com/pitchedapps/frost/facebook/requests/FbRequest.kt | |
parent | d9e2562267e549ee407e683262406581f2c4888e (diff) | |
download | frost-2.0.1.tar.gz frost-2.0.1.tar.bz2 frost-2.0.1.zip |
Fix view full image (#882)v2.0.1
* Test including full photo viewer
* Test cookie in glide
* Fix parser and add redirects to view full image
* Update changelog
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/facebook/requests/FbRequest.kt')
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/facebook/requests/FbRequest.kt | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/facebook/requests/FbRequest.kt b/app/src/main/kotlin/com/pitchedapps/frost/facebook/requests/FbRequest.kt index b5c2e4e9..692312a1 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/facebook/requests/FbRequest.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/facebook/requests/FbRequest.kt @@ -6,7 +6,10 @@ import com.pitchedapps.frost.rx.RxFlyweight import com.pitchedapps.frost.utils.L import io.reactivex.Single import io.reactivex.schedulers.Schedulers -import okhttp3.* +import okhttp3.Call +import okhttp3.FormBody +import okhttp3.OkHttpClient +import okhttp3.Request import okhttp3.logging.HttpLoggingInterceptor import org.apache.commons.text.StringEscapeUtils @@ -92,12 +95,16 @@ internal fun List<Pair<String, Any?>>.withEmptyData(vararg key: String): List<Pa return newList } -private fun String.requestBuilder() = Request.Builder() - .header("Cookie", this) - .header("User-Agent", USER_AGENT_BASIC) - .cacheControl(CacheControl.FORCE_NETWORK) +internal fun String?.requestBuilder(): Request.Builder { + val builder = Request.Builder() + .header("User-Agent", USER_AGENT_BASIC) + if (this != null) + builder.header("Cookie", this) +// .cacheControl(CacheControl.FORCE_NETWORK) + return builder +} -fun Request.Builder.call() = httpClient.newCall(build())!! +fun Request.Builder.call(): Call = httpClient.newCall(build()) fun String.getAuth(): RequestAuth { L.v { "Getting auth for ${hashCode()}" } |