Remove unnecessary headers

This commit is contained in:
William Brawner 2021-06-08 07:32:39 -06:00
parent 9664fcb4c0
commit ba1f147601

View file

@ -21,9 +21,6 @@ class APIClient {
}
val request: Request = Request.Builder().url(urlBuilder.build())
.get()
.addHeader("User-Agent", agent)
.addHeader("Referer", "https://www.kobo.com/au/en/account/wishlist")
.addHeader("Accept", "application / json, text / javascript, * / *; q = 0.01")
.addHeader("X-Requested-With", "XMLHttpRequest")
.addHeader("Cookie", "KoboSession=$cookieValue")
.build()
@ -33,13 +30,8 @@ class APIClient {
fun post(url: String, payload: String, contentType: String, responseHandler: Callback) {
val body: RequestBody = payload.toRequestBody(contentType.toMediaType())
val request: Request = Request.Builder().url(getAbsoluteUrl(url)).post(body)
.addHeader("User-Agent", agent)
.addHeader("Referer", "https://www.kobo.com/au/en/account/wishlist")
.addHeader("Accept", "application/json, text/javascript, */*; q=0.01")
.addHeader("X-Requested-With", "XMLHttpRequest")
.addHeader("Origin", "https://www.kobo.com")
.addHeader("Cookie", "KoboSession=$cookieValue")
.addHeader("Content-type", contentType)
.build()
client.newCall(request).enqueue(responseHandler)
}
@ -49,8 +41,6 @@ class APIClient {
private var client: OkHttpClient = OkHttpClient.Builder()
.retryOnConnectionFailure(false)
.build()
private const val agent =
"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:64.0) Gecko/20100101 Firefox/64.0"
private fun getAbsoluteUrl(relativeUrl: String): String {
return BASE_URL + relativeUrl
}