Comparing version 9.1.0 to 9.2.0
@@ -0,1 +1,2 @@ | ||
/// <reference types="node" /> | ||
import { Url } from 'url'; | ||
@@ -2,0 +3,0 @@ export interface Query { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var url_1 = require("url"); | ||
@@ -3,0 +4,0 @@ var querystring_1 = require("querystring"); |
import { Request } from './request'; | ||
import { Response } from './response'; | ||
export declare type Types = 'text' | 'document' | 'blob' | 'arraybuffer' | 'json' | string; | ||
export declare type Types = 'text' | 'document' | 'blob' | 'arraybuffer' | 'json'; | ||
export interface Options { | ||
@@ -10,5 +10,5 @@ type?: Types; | ||
export declare function createTransport(options: Options): { | ||
use: ((request: Request, next: () => Promise<Response>) => Promise<never>)[]; | ||
use: ((request: Request, next: () => Promise<Response>) => Promise<Response>)[]; | ||
abort: (request: Request) => void; | ||
open(request: Request): Promise<Response>; | ||
}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var response_1 = require("./response"); | ||
@@ -3,0 +4,0 @@ var index_1 = require("./plugins/index"); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var CookieJar = (function () { | ||
@@ -3,0 +4,0 @@ function CookieJar() { |
@@ -5,2 +5,3 @@ "use strict"; | ||
} | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var FormData = require("form-data"); | ||
@@ -41,4 +42,3 @@ exports.FormData = FormData; | ||
__export(require("./response")); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.default = exports.request; | ||
//# sourceMappingURL=common.js.map |
"use strict"; | ||
var __extends = (this && this.__extends) || function (d, b) { | ||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
var __extends = (this && this.__extends) || (function () { | ||
var extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
return function (d, b) { | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
})(); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var makeErrorCause = require("make-error-cause"); | ||
@@ -19,4 +25,3 @@ var PopsicleError = (function (_super) { | ||
}(makeErrorCause.BaseError)); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.default = PopsicleError; | ||
//# sourceMappingURL=error.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var FormData = require("form-data"); | ||
@@ -12,4 +13,3 @@ function form(obj) { | ||
} | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.default = form; | ||
//# sourceMappingURL=form.js.map |
@@ -0,5 +1,5 @@ | ||
/// <reference types="node" /> | ||
import { IncomingMessage, ClientRequest } from 'http'; | ||
import { CookieJar } from 'tough-cookie'; | ||
import { Request } from './request'; | ||
import { Response } from './response'; | ||
import { TransportOptions } from './request'; | ||
export declare type Types = 'text' | 'buffer' | 'array' | 'uint8array' | 'stream' | string; | ||
@@ -20,6 +20,2 @@ export interface Options { | ||
} | ||
export declare function createTransport(options: Options): { | ||
use: ((request: Request, next: () => Promise<Response>) => Promise<never>)[]; | ||
abort: (request: Request) => void; | ||
open(request: Request): Promise<any>; | ||
}; | ||
export declare function createTransport(options: Options): TransportOptions; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var http_1 = require("http"); | ||
@@ -28,7 +29,5 @@ var https_1 = require("https"); | ||
var REDIRECT_STATUS = { | ||
'300': REDIRECT_TYPE.FOLLOW_WITH_GET, | ||
'301': REDIRECT_TYPE.FOLLOW_WITH_GET, | ||
'302': REDIRECT_TYPE.FOLLOW_WITH_GET, | ||
'303': REDIRECT_TYPE.FOLLOW_WITH_GET, | ||
'305': REDIRECT_TYPE.FOLLOW_WITH_GET, | ||
'307': REDIRECT_TYPE.FOLLOW_WITH_CONFIRMATION, | ||
@@ -96,7 +95,7 @@ '308': REDIRECT_TYPE.FOLLOW_WITH_CONFIRMATION | ||
if (followRedirects !== false && redirect != null && headers.location) { | ||
var newUrl = urlLib.resolve(url, headers.location); | ||
var newUrl = urlLib.resolve(url, String(headers.location)); | ||
incomingMessage.resume(); | ||
if (redirect === REDIRECT_TYPE.FOLLOW_WITH_GET) { | ||
request.set('Content-Length', '0'); | ||
return get(newUrl, 'GET'); | ||
return get(newUrl, arg.method === 'HEAD' ? 'HEAD' : 'GET'); | ||
} | ||
@@ -103,0 +102,0 @@ if (redirect === REDIRECT_TYPE.FOLLOW_WITH_CONFIRMATION) { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var tough_cookie_1 = require("tough-cookie"); | ||
@@ -6,4 +7,3 @@ function cookieJar(store) { | ||
} | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.default = cookieJar; | ||
//# sourceMappingURL=jar.js.map |
@@ -5,3 +5,4 @@ "use strict"; | ||
} | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__export(require("./common")); | ||
//# sourceMappingURL=browser.js.map |
@@ -5,4 +5,4 @@ import { Request } from '../request'; | ||
export declare const headers: () => (request: Request, next: () => Promise<Response>) => Promise<Response>; | ||
export declare const stringify: () => (request: Request, next: () => Promise<Response>) => Promise<never>; | ||
export declare const stringify: () => (request: Request, next: () => Promise<Response>) => Promise<Response>; | ||
export declare type ParseType = 'json' | 'urlencoded'; | ||
export declare function parse(type: ParseType | ParseType[], strict?: boolean): (request: Request, next: () => Promise<Response>) => Promise<Response>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var FormData = require("form-data"); | ||
@@ -3,0 +4,0 @@ var querystring_1 = require("querystring"); |
@@ -5,2 +5,3 @@ "use strict"; | ||
} | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var FormData = require("form-data"); | ||
@@ -7,0 +8,0 @@ var common_1 = require("./common"); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
function isHostObject(object) { | ||
@@ -14,4 +15,3 @@ var str = Object.prototype.toString.call(object); | ||
} | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.default = isHostObject; | ||
//# sourceMappingURL=browser.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
function isHostObject(object) { | ||
return typeof object.pipe === 'function' || Buffer.isBuffer(object); | ||
} | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.default = isHostObject; | ||
//# sourceMappingURL=index.js.map |
@@ -56,3 +56,3 @@ import { Base, BaseOptions, Headers } from './base'; | ||
then<T>(onFulfilled?: (response: Response) => T | PromiseLike<T>, onRejected?: (error: PopsicleError) => T | PromiseLike<T>): Promise<T>; | ||
catch<T>(onRejected: (error: PopsicleError) => T): Promise<T>; | ||
catch<T>(onRejected: (error: PopsicleError) => T): Promise<T | Response>; | ||
exec(cb: (error: PopsicleError | null, response?: Response) => void): void; | ||
@@ -68,3 +68,3 @@ toOptions(): RequestOptions; | ||
abort(): this; | ||
handle(): Promise<never>; | ||
handle(): Promise<Response>; | ||
readonly completed: number; | ||
@@ -71,0 +71,0 @@ readonly completedBytes: number; |
"use strict"; | ||
var __extends = (this && this.__extends) || function (d, b) { | ||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
var __extends = (this && this.__extends) || (function () { | ||
var extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
return function (d, b) { | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
})(); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var base_1 = require("./base"); | ||
@@ -44,3 +50,3 @@ var support_1 = require("./support"); | ||
Request.prototype.exec = function (cb) { | ||
this.then(function (res) { return cb(null, res); }, cb); | ||
void this.then(function (res) { return cb(null, res); }, cb); | ||
}; | ||
@@ -159,6 +165,6 @@ Request.prototype.toOptions = function () { | ||
}); | ||
Promise.resolve(_this.transport.open(_this)).then(function (res) { return resolve(res); }, function (err) { return reject(err); }); | ||
void Promise.resolve(_this.transport.open(_this)).then(function (res) { return resolve(res); }, function (err) { return reject(err); }); | ||
}); | ||
if (timeout > 0) { | ||
result.then(function () { return clearTimeout(timer); }, function () { return clearTimeout(timer); }); | ||
void result.then(function () { return clearTimeout(timer); }, function () { return clearTimeout(timer); }); | ||
} | ||
@@ -165,0 +171,0 @@ return result; |
"use strict"; | ||
var __extends = (this && this.__extends) || function (d, b) { | ||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
var __extends = (this && this.__extends) || (function () { | ||
var extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
return function (d, b) { | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
})(); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var base_1 = require("./base"); | ||
@@ -8,0 +14,0 @@ var Response = (function (_super) { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
function splice(arr, start, count) { | ||
@@ -3,0 +4,0 @@ if (count === void 0) { count = 1; } |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var test = require("blue-tape"); | ||
@@ -750,3 +751,3 @@ var methods = require("methods"); | ||
open: function () { | ||
return Promise.resolve({ | ||
return Promise.resolve(new popsicle.Response({ | ||
url: '/foo', | ||
@@ -757,3 +758,3 @@ body: 'testing', | ||
statusText: 'OK' | ||
}); | ||
})); | ||
} | ||
@@ -760,0 +761,0 @@ } |
{ | ||
"name": "popsicle", | ||
"version": "9.1.0", | ||
"version": "9.2.0", | ||
"description": "Simple HTTP requests for node and the browser", | ||
@@ -21,3 +21,3 @@ "main": "dist/common.js", | ||
"scripts": { | ||
"lint": "tslint \"src/**/*.ts\"", | ||
"lint": "tslint \"src/**/*.ts\" --project tsconfig.json --type-check", | ||
"check-size": "browserify . -s popsicle --external bluebird > popsicle.js && du -h popsicle.js", | ||
@@ -57,6 +57,7 @@ "build": "rm -rf dist/ && tsc && npm run check-size", | ||
"devDependencies": { | ||
"@types/node": "^8.0.0", | ||
"blue-tape": "^1.0.0", | ||
"bluebird": "^3.0.5", | ||
"body-parser": "^1.9.2", | ||
"browserify": "^13.0.0", | ||
"browserify": "^14.3.0", | ||
"envify": "^4.0.0", | ||
@@ -67,6 +68,6 @@ "express": "^4.10.2", | ||
"tap-spec": "^4.1.1", | ||
"tape-run": "2.1.0", | ||
"tslint": "^4.0.2", | ||
"tslint-config-standard": "^2.0.0", | ||
"typescript": "^2.1.4", | ||
"tape-run": "3.0.0", | ||
"tslint": "^5.2.0", | ||
"tslint-config-standard": "^7.0.0", | ||
"typescript": "^2.4.1", | ||
"typings": "^2.0.0" | ||
@@ -73,0 +74,0 @@ }, |
# ![Popsicle](https://cdn.rawgit.com/blakeembrey/popsicle/master/logo.svg) | ||
[![NPM version][npm-image]][npm-url] | ||
[![NPM downloads][downloads-image]][downloads-url] | ||
[![Build status][travis-image]][travis-url] | ||
[![Test coverage][coveralls-image]][coveralls-url] | ||
[![NPM version](https://img.shields.io/npm/v/popsicle.svg?style=flat)](https://npmjs.org/package/popsicle) | ||
[![NPM downloads](https://img.shields.io/npm/dm/popsicle.svg?style=flat)](https://npmjs.org/package/popsicle) | ||
[![Build status](https://img.shields.io/travis/blakeembrey/popsicle.svg?style=flat)](https://travis-ci.org/blakeembrey/popsicle) | ||
[![Test coverage](https://img.shields.io/coveralls/blakeembrey/popsicle.svg?style=flat)](https://coveralls.io/r/blakeembrey/popsicle?branch=master) | ||
[![Greenkeeper badge](https://badges.greenkeeper.io/blakeembrey/popsicle.svg)](https://greenkeeper.io/) | ||
@@ -442,10 +443,1 @@ > **Popsicle** is the easiest way to make HTTP requests - a consistent, intuitive and tiny API that works on node and the browser. 9.37 kB in browsers, after minification and gzipping, including dependencies (with `url` being the bulk of it). | ||
MIT | ||
[npm-image]: https://img.shields.io/npm/v/popsicle.svg?style=flat | ||
[npm-url]: https://npmjs.org/package/popsicle | ||
[downloads-image]: https://img.shields.io/npm/dm/popsicle.svg?style=flat | ||
[downloads-url]: https://npmjs.org/package/popsicle | ||
[travis-image]: https://img.shields.io/travis/blakeembrey/popsicle.svg?style=flat | ||
[travis-url]: https://travis-ci.org/blakeembrey/popsicle | ||
[coveralls-image]: https://img.shields.io/coveralls/blakeembrey/popsicle.svg?style=flat | ||
[coveralls-url]: https://coveralls.io/r/blakeembrey/popsicle?branch=master |
@@ -6,5 +6,3 @@ { | ||
}, | ||
"globalDependencies": { | ||
"node": "registry:env/node#6.0.0+20160622202520" | ||
}, | ||
"globalDependencies": {}, | ||
"dependencies": { | ||
@@ -11,0 +9,0 @@ "concat-stream": "registry:npm/concat-stream#1.0.0+20160211003958", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
244399
2182
15
443