lib/Request.js
function toSignatureBaseString(method, url, header_params, query_params) {
    var arr = [];
    var i;

    for (i in header_params) {
        if (header_params[i] !== undefined && header_params[i] !== '') {
            arr.push([encode(i), encode(header_params[i] + '')]);
        }
    }

    for (i in query_params) {
        if (query_params[i] !== undefined && query_params[i] !== '') {
            arr.push([encode(i), encode(query_params[i] + '')]);
        }
    }

    arr = arr.sort(function lexicalSort(a, b) {
        if (a[0] < b[0]) {
            return -1;
        } else if (a[0] > b[0]) {
            return 1;
        } else {
            if (a[1] < b[1]) {
                return -1;
            } else if (a[1] > b[1]) {
                return 1;
            } else {
                return 0;
            }
        }
    }).map(function (el) {
        return el.join("=");
    });

    return [method, encode(url), encode(arr.join('&'))].join('&');
}
function toSignatureBaseString(method, url, header_params, query_params) {
    var arr = [];
    var i;

    for (i in header_params) {
        if (header_params[i] !== undefined && header_params[i] !== '') {
            arr.push([encode(i), encode(header_params[i] + '')]);
        }
    }

    for (i in query_params) {
        if (query_params[i] !== undefined && query_params[i] !== '') {
            arr.push([encode(i), encode(query_params[i] + '')]);
        }
    }

    arr = arr.sort(function lexicalSort(a, b) {
        if (a[0] < b[0]) {
            return -1;
        } else if (a[0] > b[0]) {
            return 1;
        } else {
            if (a[1] < b[1]) {
                return -1;
            } else if (a[1] > b[1]) {
                return 1;
            } else {
                return 0;
            }
        }
    }).map(function (el) {
        return el.join("=");
    });

    return [method, encode(url), encode(arr.join('&'))].join('&');
}
Generate a signature base string for the request

@param method {string} ['GET', 'POST', 'PUT', ...]
@param url {string} A valid http(s) url
@param header_params A key value paired object of additional headers
@param query_params {object} A key value paired object of data
example: {'q':'foobar'}
for GET this will append a query string