package com.narutohuo.xindazhou.common.networkrx.cookie

import okhttp3.Cookie
import okhttp3.CookieJar
import okhttp3.HttpUrl

/**
 * CookieJar 实现
 * 
 * 管理 HTTP Cookie
 * 
 * 对应 MVVMHabit 的 Cookie 管理
 */
class CookieJarImpl(private val cookieStore: CookieStore) : CookieJar {
    
    override fun saveFromResponse(url: HttpUrl, cookies: List<Cookie>) {
        cookieStore.saveCookie(url, cookies)
    }
    
    override fun loadForRequest(url: HttpUrl): List<Cookie> {
        return cookieStore.loadCookie(url)
    }
}