Permalink
Browse files

Merge pull request #381 from landeiro/master

Resolving "Invalid signature. Expected signature base string: "
  • Loading branch information...
2 parents 000ee26 + 62dbbf3 commit 0f1fec86260b125ed4c98c0fcb892d7bf4078bc9 @mikeal mikeal committed Nov 29, 2012
Showing with 12 additions and 11 deletions.
  1. +12 −11 main.js
View
23 main.js
@@ -242,6 +242,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)
@@ -258,16 +269,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) {
@@ -1124,4 +1126,3 @@ function toJSON () {
}
Request.prototype.toJSON = toJSON
-

0 comments on commit 0f1fec8

Please sign in to comment.