Permalink
Browse files

Resolving the Invalid signature when using "qs"

  • Loading branch information...
1 parent bf8315d commit 62dbbf3d77b0851ba424d4f09d1d0c0be91c1f2d @landeiro committed Nov 28, 2012
Showing with 12 additions and 11 deletions.
  1. +12 −11 main.js
View
23 main.js
@@ -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)
@@ -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) {
@@ -1125,4 +1127,3 @@ function toJSON () {
}
Request.prototype.toJSON = toJSON
-

0 comments on commit 62dbbf3

Please sign in to comment.