Skip to content
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

add ; at the end to have a valid cookie #144

Merged
merged 1 commit into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ class AddCookiesInterceptor(private val context: Context) : Interceptor {
val prefCookies: Set<String> =
context.dataStore.data.first()[PreferenceKeys.PREF_COOKIES]?.toMutableSet()
?: mutableSetOf()
builder.addHeader("Cookie", prefCookies.joinToString("; "))
for (cookie in prefCookies) {
builder.addHeader("Cookie", cookie)
}
}
}
return chain.proceed(builder.build())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class ReceivedCookiesInterceptor(private val context: Context) : Interceptor {
@Throws(IOException::class)
override fun intercept(chain: Interceptor.Chain): Response {
val originalResponse: Response = chain.proceed(chain.request())
//only add the jsession cookie from session request.
// only add the jsession cookie from session request.
if (
chain.request().url.encodedPath.contains("session") and
originalResponse.headers("Set-Cookie").isNotEmpty()
Expand All @@ -50,7 +50,7 @@ class ReceivedCookiesInterceptor(private val context: Context) : Interceptor {
for (header in originalResponse.headers("Set-Cookie")) {
val jsessionId = Regex("JSESSIONID=([^;]+)").find(header)?.value
if (jsessionId != null) {
cookies.add(jsessionId)
cookies.add("$jsessionId;")
}
}
runBlocking {
Expand Down
Loading