Skip to content

Commit

Permalink
Resolving the Invalid signature when using "qs"
Browse files Browse the repository at this point in the history
  • Loading branch information
landeiro committed Nov 28, 2012
1 parent bf8315d commit 62dbbf3
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions main.js
Expand Up @@ -243,6 +243,17 @@ Request.prototype.init = function (options) {
if (options.form) {
self.form(options.form)
}

if (options.qs) self.qs(options.qs)

if (self.uri.path) {
self.path = self.uri.path
} else {
self.path = self.uri.pathname + (self.uri.search || "")
}

if (self.path.length === 0) self.path = '/'


if (options.oauth) {
self.oauth(options.oauth)
Expand All @@ -259,16 +270,7 @@ Request.prototype.init = function (options) {
self.headers['proxy-authorization'] = "Basic " + toBase64(self.proxy.auth.split(':').map(function(item){ return qs.unescape(item)}).join(':'))
}

if (options.qs) self.qs(options.qs)

if (self.uri.path) {
self.path = self.uri.path
} else {
self.path = self.uri.pathname + (self.uri.search || "")
}

if (self.path.length === 0) self.path = '/'


if (self.proxy && !self.tunnel) self.path = (self.uri.protocol + '//' + self.uri.host + self.path)

if (options.json) {
Expand Down Expand Up @@ -1125,4 +1127,3 @@ function toJSON () {
}

Request.prototype.toJSON = toJSON

0 comments on commit 62dbbf3

Please sign in to comment.