Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

removing 3rd party request lib completely

  • Loading branch information...
commit e2af9bce699ce80f256280271fc63a77894d9f8a 1 parent d485493
@ryanfitz ryanfitz authored
View
3  lib/dynode/client.js
@@ -1,5 +1,4 @@
-var request = require('request'),
- events = require('events'),
+var events = require('events'),
util = require('utile'),
_ = require('underscore'),
retry = require('retry'),
View
3  lib/dynode/request.js
@@ -25,8 +25,7 @@ Request.prototype.send = function(action, messageBody, cb) {
"x-amz-date" : new Date().toGMTString(),
"x-amz-security-token" : credentials.sessionToken,
"x-amz-target" : self.config.prefix + action,
- "content-type" : "application/x-amz-json-1.0",
- "Connection" : "Keep-Alive"
+ "content-type" : "application/x-amz-json-1.0"
};
var opts = {
View
36 lib/dynode/sts.js
@@ -1,4 +1,5 @@
-var request = require('request'),
+var https = require("https"),
+ querystring = require('querystring'),
crypto = require('crypto'),
URL = require('url'),
querystring = require('querystring'),
@@ -50,23 +51,30 @@ STS.prototype.getSessionToken = function(cb) {
var self = this;
- var url = URL.format({host:defaults.host, protocol: "https", query : this._buildParams() });
-
- request(url, function (err, resp, body) {
- if(err) return cb(err);
-
- self.parser.parseString(body, function (err, result) {
- if(err) return cb(err);
+ var opts = {
+ host : defaults.host,
+ path : "/?" + querystring.stringify(this._buildParams())
+ };
- if(resp.statusCode != 200){
- return cb(new AmazonError({type : result.Error.Code, message: result.Error.Message, statusCode: resp.statusCode}));
- }
-
- self.credentials = result.GetSessionTokenResult.Credentials;
+ var request = https.get(opts, function(res) {
+ var data = "";
- return cb(null, self.credentials);
+ res.on("data", function(chunk){ data += chunk });
+ res.on("end", function() {
+ self.parser.parseString(data, function (err, result) {
+ if(err) return cb(err);
+
+ if (res.statusCode != 200) {
+ return cb(new AmazonError({type : result.Error.Code, message: result.Error.Message, statusCode: res.statusCode}));
+ }
+
+ self.credentials = result.GetSessionTokenResult.Credentials;
+ return cb(null, self.credentials);
+ });
});
});
+
+ request.on("error", cb);
};
STS.prototype._buildParams = function() {
View
1  package.json
@@ -15,7 +15,6 @@
],
"keywords": ["dynamoDB", "database", "aws", "nosql", "amazon"],
"dependencies": {
- "request": "2.9.x",
"utile": "0.0.10",
"underscore": "1.3.x",
"xml2js": "0.1.x",
Please sign in to comment.
Something went wrong with that request. Please try again.