package com.braintreepayments.api.internal;

import android.text.TextUtils;

import com.braintreepayments.api.BuildConfig;
import com.braintreepayments.api.exceptions.BraintreeApiErrorResponse;
import com.braintreepayments.api.exceptions.UnprocessableEntityException;
import com.braintreepayments.api.interfaces.HttpResponseCallback;

import java.io.IOException;
import java.net.HttpURLConnection;

import javax.net.ssl.SSLException;

/**
 * Network request class that handles BraintreeApi request specifics and threading.
 */
public class BraintreeApiHttpClient extends HttpClient {

    public static final String API_VERSION_2016_10_07 = "2016-10-07";

    private final String mAccessToken;
    private final String mApiVersion;

    public BraintreeApiHttpClient(String baseUrl, String accessToken) {
        super();

        mBaseUrl = baseUrl;
        mAccessToken = accessToken;
        mApiVersion = API_VERSION_2016_10_07;

        setUserAgent("braintree/android/" + BuildConfig.VERSION_NAME);

        try {
            setSSLSocketFactory(new TLSSocketFactory(BraintreeApiCertificate.getCertInputStream()));
        } catch (SSLException e) {
            setSSLSocketFactory(null);
        }
    }

    @Override
    protected HttpURLConnection init(String url) throws IOException {
        HttpURLConnection connection = super.init(url);

        if (!TextUtils.isEmpty(mAccessToken)) {
            connection.setRequestProperty("Authorization", "Bearer " + mAccessToken);
        }

        connection.setRequestProperty("Braintree-Version", mApiVersion);

        return connection;
    }

    @Override
    protected String parseResponse(HttpURLConnection connection) throws Exception {
        try {
            return super.parseResponse(connection);
        } catch (UnprocessableEntityException e) {
            throw new BraintreeApiErrorResponse(e.getMessage());
        }
    }
}

@@ -676,25 +676,27 @@
 tring mA
-ccessToke
+uthorizatio
 n;%0A    p
@@ -787,25 +787,189 @@
 String a
-ccessToke
+uthorization) %7B%0A        this(baseUrl, authorization, API_VERSION_2016_10_07);%0A    %7D%0A%0A    public BraintreeApiHttpClient(String baseUrl, String authorization, String apiVersio
 n) %7B%0A   
@@ -1025,31 +1025,35 @@
   mA
-ccessToken = accessToke
+uthorization = authorizatio
 n;%0A 
@@ -1073,38 +1073,26 @@
 rsion = 
-API_VERSION_2016_10_07
+apiVersion
 ;%0A%0A     
@@ -1538,25 +1538,27 @@
 Empty(mA
-ccessToke
+uthorizatio
 n)) %7B%0A  
@@ -1632,17 +1632,19 @@
 + mA
-ccessToke
+uthorizatio
 n);%0A

Make BraintreeApiHttpClient member naming and constructor more generic to enable easier subclassing