Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

q-http

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

q-http - npm Package Compare versions

Comparing version 0.1.7 to 0.1.8

9

package.json
{
"name": "q-http",
"version": "0.1.7",
"version": "0.1.8",
"description": "Q promise based HTTP client and server interface",

@@ -19,5 +19,8 @@ "homepage": "http://github.com/kriskowal/q-http/",

"dependencies": {
"q": "0.7.1",
"q-io": "0.0.10"
"q": "0.7.2",
"q-io": "0.0.11"
},
"devDependencies": {
"test": "0.4.1"
},
"repository": {

@@ -24,0 +27,0 @@ "type": "git",

@@ -23,18 +23,73 @@

var server = HTTP.Server(function () {
return response;
});
exports['test basic'] = function (ASSERT, done) {
Q.when(server.listen(8080), function () {
console.log("Listening on", server.port);
return Q.when(HTTP.request(request), function (response) {
return Q.when(response.body, function (body) {
var done = body.forEach(function (chunk) {
console.log(chunk.toString("utf-8"));
var server = HTTP.Server(function () {
return response;
});
Q.when(server.listen(8080), function () {
return Q.when(HTTP.request(request))
.then(function (response) {
ASSERT.ok(!Q.isPromise(response.body), "body is not a promise")
var acc = [];
return response.body.forEach(function (chunk) {
acc.push(chunk.toString("utf-8"));
}).then(function () {
ASSERT.equal(acc.join(""), "Hello, World!", "body is hello world");
});
Q.when(done, server.stop);
});
})
})
.fin(server.stop)
.fin(done)
.fail(function (reason) {
ASSERT.ok(false, reason);
})
}
var deferredResponse = {
"status": 200,
"headers": {
"content-type": "text/plain; charset=utf-8"
},
"body": {
"forEach": function (write) {
var deferred = Q.defer();
write("Hello, World!");
setTimeout(function () {
deferred.resolve();
}, 100);
return deferred.promise;
}
}
};
exports['test deferred'] = function (ASSERT, done) {
var server = HTTP.Server(function () {
return deferredResponse;
});
})
.end();
Q.when(server.listen(8080), function () {
return Q.when(HTTP.request(request))
.then(function (response) {
var acc = [];
return response.body.forEach(function (chunk) {
acc.push(chunk.toString("utf-8"));
}).then(function () {
ASSERT.equal(acc.join(""), "Hello, World!", "body is hello world");
});
})
})
.fin(server.stop)
.fin(done)
.fail(function (reason) {
ASSERT.ok(false, reason);
})
}
if (module === require.main) {
require("test").run(exports);
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc