udacity / ud843-QuakeReport

Discover earthquake activity around the world.
Other
343 stars 1.17k forks source link

API redirecting to HTTPS #74

Closed crlsndrsjmnz closed 2 years ago

crlsndrsjmnz commented 7 years ago

When I open the application I get the following error:

com.example.android.quakereport E/QueryUtils: Error response code: 301

That is caused by the API, which is returning Response Code 301 (Moved Permanently) on QueryUtils:109, method makeHttpRequest.

Full response is:

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">301 Moved Permanently

Moved Permanently

The document has moved here.

Naveenkhasyap commented 7 years ago

@crlsndrsjmnz Hi I also faced this issue, earlier I thought this might be because of request method is Http not https but this didn't solve the issue, later by including Log statements I came to know that issue is in EarthquakeLoader constructor where we are assigning null to mUrl , Instead it should be the passed String Url which is an input param to constructor i.e. mUrl = url will work , then it worked for me .

elit1910 commented 7 years ago

Thank YOU @Naveenkhasyap ! Worked for me!

yvasilyev92 commented 7 years ago

I got the same issue but then I simply changed the "http..." in EarthquakeActivity to "https..." and that fixed everything, because according to the USGS API documentation found here the BASE URL is no longer http://earthquake.usgs.gov/fdsnws/event/1/[METHOD[?PARAMETERS]] but https://earthquake.usgs.gov/fdsnws/event/1/[METHOD[?PARAMETERS]]

aydinaytac commented 6 years ago

I have just change the protocol from HTTP to HTTPS and the "response code: 301" error has gone 👍

asadnawaz126 commented 6 years ago

None of these fixes work. Somone please help me

https://github.com/asadnawaz126/ud843-QuakeReport/tree/starting-point/app/src/main/java/com/example/android/quakereport