escape() has been deprecated, using encodeURI to avoid crashes on special charactes in request headers