It is somthing very weird.
I am using my android device to send messages to my node js server in LAN.
And now here comes the problem: When I send POST HTTP it DOES work. But when I send GET HTTP it DOES NOT work and the server even not recieve the get request.
This is my code for recieving the get:
app.get('/auth/facebook', passport.authenticate('facebook'));
And this is the code in androif for sending the GET:
public class Background_confirmation extends AsyncTask<Void, Integer, String> {
@Override
protected void onPreExecute() {
super.onPreExecute();
// progressDialog = ProgressDialog.show(Confirmation.this, "Please wait...", "Retrieving data ...", true);
}
@Override
protected String doInBackground(Void... params) {
HttpClient client = new DefaultHttpClient();
HttpGet request = new HttpGet("http://localhost:8080/auth/facebook");
// replace with your url
HttpResponse response = null;
try {
response = client.execute(request);
Log.d("Response of GET request", response.toString());
} catch (ClientProtocolException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return response.toString();
}
@Override
protected void onPostExecute(String result) {
super.onPostExecute(result);
// progressDialog.setCancelable(true);
// }
}
Someone have an idea for why it happen?
You are trying to get the data from localhost
(i.e., your Android device) instead of from your server.