title: Sending authorization headers using httpUrlConnection in Android
body: <p>I am trying to set "Authorization" header while using HttpUrlConnection but I see it on the server as "HTTP_AUTHORIZATION".</p>
  
  <p>Here is my code:</p>
  
  <pre><code>public static String doGet(String params, String accessToken)
              throws MHNetworkException {
          try {
              URL url = new URL(getServerUrl());
  
              HttpURLConnection conn = (HttpURLConnection) url.openConnection();
              conn.setRequestProperty("Content-Type", "application/json");
              conn.setRequestProperty("Authorization", "Token token="
                      + accessToken);
              conn.setRequestMethod("GET");
  
              int httpStatus = conn.getResponseCode();
              Log.v(tag, "httpStatus " + httpStatus);
  
              if (httpStatus == 200) {
                  return MHIOUtil.getInputStreamAsString(conn.getInputStream());
              } 
          } catch (MalformedURLException me) {
  
          } catch (IOException ioe) {
  
          }
      }
  </code></pre>
  
  <p>BTW the "Content-Type" header is also being changed to CONTENT_TYPE.</p>
  
  <p>Why is Android sending changing it and is there any way for me to sent it exactly in the way I want. Or am I doing something wrong here? We are using nginx and Rails on the backend if that matters.</p>
  
  <p>Please do not recommend using HttpClient. I just want to use HttpURLConnection if I can get this to work as Google's Android Developers said that they are going to put all their efforts in HttpURLConnection.</p>
  
  <p>Thank you.</p>