Removes whitespace, properly returns callbacks, and don't leak data to the global scope.
Use an options object instead passing a ton of separate variables.
Replace use of regex with the querystring module.
Check statusCode before returning response, and update error messages to be more-descriptive.