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.8 to 0.1.10

CHANGES.md

4

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

@@ -9,3 +9,3 @@ "homepage": "http://github.com/kriskowal/q-http/",

"mail": "kris@cixar.com",
"web": "http://github.com/kriskowal/q-http/issues"
"url": "http://github.com/kriskowal/q-http/issues"
},

@@ -12,0 +12,0 @@ "licenses": [

@@ -207,2 +207,38 @@

exports.normalizeRequest = function (request) {
if (typeof request === "string") {
request = {
url: request
};
}
if (request.url) {
var url = URL.parse(request.url);
request.host = url.hostname;
request.port = url.port;
request.ssl = url.protocol === "https:";
request.method = request.method || "GET";
request.path = (url.pathname || "") + (url.search || "");
request.headers = request.headers || {};
request.headers.host = url.hostname; // FIXME name consistency
}
return request;
};
exports.normalizeResponse = function (response) {
if (response === void 0) {
return;
}
if (typeof response == "string") {
response = [response];
}
if (response.forEach) {
response = {
status: 200,
headers: {},
body: response
}
}
return response;
};
/**

@@ -218,17 +254,3 @@ * Issues an HTTP request.

if (typeof request === "string") {
request = {
url: request
};
}
if (request.url) {
var url = URL.parse(request.url);
request.host = url.hostname;
request.port = url.port;
request.ssl = url.protocol === "https:";
request.method = request.method || "GET";
request.path = (url.pathname || "") + (url.search || "");
request.headers = request.headers || {};
request.headers.host = url.hostname; // FIXME name consistency
}
request = exports.normalizeRequest(request);

@@ -238,2 +260,7 @@ var deferred = Q.defer();

var http = ssl ? HTTPS : HTTP;
var headers = request.headers || {};
headers.host = headers.host || request.host;
var _request = http.request({

@@ -244,3 +271,3 @@ "host": request.host,

"method": request.method || "GET",
"headers": request.headers || {}
"headers": headers
}, function (_response) {

@@ -247,0 +274,0 @@ deferred.resolve(exports.ClientResponse(_response));

var Q = require("q");
var HTTP = require("q-http");
var HTTP = require("../q-http");

@@ -5,0 +5,0 @@ var request = {

var Q = require("q");
var HTTP = require("q-http");
var HTTP = require("../q-http");

@@ -5,0 +5,0 @@ var request = {

var Q = require("q");
var HTTP = require("q-http");
var HTTP = require("../q-http");

@@ -5,0 +5,0 @@ var request = {

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