linkkader
linkkader

Reputation: 335

Okhttp always return error 404 but work perfectly in chrome on windows

Hi I use okhttp it works fine but for this url okhttp always return 404 response

I try this link on chrome on windows and it works perfecty and Method used is GET

val client = OkHttpClient()
val request = Request.Builder().url(url).build()
client.newCall(request).enqueue(object : Callback{
   override fun onFailure(call: Call, e: IOException) {}
   override fun onResponse(call: Call, response: Response) {}
   })

thanks

Upvotes: 1

Views: 927

Answers (2)

Yuri Schimke
Yuri Schimke

Reputation: 13488

Start by reproducing this in curl. Copy as Curl and see if that works. It likely relies on being logged in with session auth.

https://developers.google.com/web/updates/2015/05/replay-a-network-request-in-curl

If you confirm that works, try those same headers in a request in OkHttp. Then work out if there is a clean API to hit.enter image description here

Upvotes: 1

Henry Twist
Henry Twist

Reputation: 5990

Although it might work for you, I personally get a 404 error when using Chrome, so I think this might be a server side issue and not anything related to your code.

Upvotes: 0

Related Questions