使用Node js无法获取GET HTTP

这是非常奇怪的事情。

我正在使用我的android设备发送消息到我局域网中的节点js服务器。

现在问题来了:当我发送POST HTTP时,它就可以工作了。 但是,当我发送GET HTTP它不起作用,服务器甚至没有收到请求。

这是我接收get的代码:

app.get('/auth/facebook', passport.authenticate('facebook')); 

这是用于发送GET的androif代码:

  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); // } } 

有人知道为什么会发生?

您正在尝试从localhost (即您的Android设备)获取数据,而不是从服务器获取数据。