net/src/main/java/com/stanfy/enroscar/net/operation/RequestDescription.java
protected void onURLConnectionPrepared(final Context context, final URLConnection urlConnection) {
    if (contentType != null) {
      urlConnection.addRequestProperty("Content-Type", contentType);
    }
    if (contentLanguage != null) {
      urlConnection.addRequestProperty("Accept-Language", contentLanguage);
    }
    urlConnection.addRequestProperty("Accept-Encoding", IoUtils.ENCODING_GZIP);
    urlConnection.addRequestProperty("User-Agent", buildUserAgent(context));

    if (headers != null) {
      for (String name : headers.keySet()) {
        urlConnection.addRequestProperty(name, headers.getString(name));
      }
    }
  }
protected void onURLConnectionPrepared(final Context context, final URLConnection urlConnection) {
    if (contentType != null) {
      urlConnection.addRequestProperty("Content-Type", contentType);
    }
    if (contentLanguage != null) {
      urlConnection.addRequestProperty("Accept-Language", contentLanguage);
    }
    urlConnection.addRequestProperty("Accept-Encoding", IoUtils.ENCODING_GZIP);
    urlConnection.addRequestProperty("User-Agent", buildUserAgent(context));

    if (headers != null) {
      for (String name : headers.keySet()) {
        urlConnection.addRequestProperty(name, headers.getString(name));
      }
    }
  }
protected void onURLConnectionPrepared ( final Context context , final URLConnection urlConnection ) { if ( contentType != null ) { urlConnection . addRequestProperty ( "Content-Type" , contentType ) ; } if ( contentLanguage != null ) { urlConnection . addRequestProperty ( "Accept-Language" , contentLanguage ) ; } urlConnection . addRequestProperty ( "Accept-Encoding" , IoUtils . ENCODING_GZIP ) ; urlConnection . addRequestProperty ( "User-Agent" , buildUserAgent ( context ) ) ; if ( headers != null ) { for ( String name : headers . keySet ( ) ) { urlConnection . addRequestProperty ( name , headers . getString ( name ) ) ; } } }
A good place to set custom request headers.
@param context system context
@param urlConnection URL connection instance
A good place to set custom request headers .