private HttpRequestBase getMethod(String url, HttpMethod requestMethod, Map<String, String> headers,
                                      Map<String, String> params, File data) {

        if (requestMethod == HttpMethod.POST) {
            HttpPost httpPost = new HttpPost(url);
            setReqHeaders(httpPost, headers);

            if (params != null) {
                httpPost.setEntity(getParamEntity(params));
            }

            if (data != null) {
                httpPost.setEntity(getFileEntity(data));
            }

            return httpPost;
        } else if (requestMethod == HttpMethod.PUT) {
            HttpPut httpPut = new HttpPut(url);
            setReqHeaders(httpPut, headers);

            if (params != null) {
                httpPut.setEntity(getParamEntity(params));
            }

            if (data != null) {
                httpPut.setEntity(getFileEntity(data));
            }

            return httpPut;
        } else if (requestMethod == HttpMethod.DELETE) {
            if (params != null) {
                url = appendParams(url, mapToQueryString(params));
            }

            HttpDelete httpDelete = new HttpDelete(url);
            setReqHeaders(httpDelete, headers);

            return httpDelete;

        } else {
            if (params != null) {
                url = appendParams(url, mapToQueryString(params));
            }

            HttpGet httpGet = new HttpGet(url);
            setReqHeaders(httpGet, headers);

            return httpGet;
        }
    }