- // Set the `x-requested-with` header property.
- httpUrlConnection.setRequestProperty("x-requested-with", "");
-
- // Add the `x-requested-with` header to the string builder and format the text.
- requestHeadersBuilder.append(System.getProperty("line.separator"));
- if (Build.VERSION.SDK_INT >= 21) { // Newer versions of Android are so smart.
- requestHeadersBuilder.append("x-requested-with", new StyleSpan(Typeface.BOLD), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
- } else { // Older versions not so much.
- oldRequestHeadersBuilderLength = requestHeadersBuilder.length();
- requestHeadersBuilder.append("x-requested-with");
- newRequestHeadersBuilderLength = requestHeadersBuilder.length();
- requestHeadersBuilder.setSpan(new StyleSpan(Typeface.BOLD), oldRequestHeadersBuilderLength, newRequestHeadersBuilderLength, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
- }
- requestHeadersBuilder.append(": ");
-
-