Template Upload
This commit is contained in:
21
node_modules/popsicle/LICENSE
generated
vendored
Normal file
21
node_modules/popsicle/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Blake Embrey (hello@blakeembrey.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
400
node_modules/popsicle/README.md
generated
vendored
Normal file
400
node_modules/popsicle/README.md
generated
vendored
Normal file
@ -0,0 +1,400 @@
|
||||
# 
|
||||
|
||||
[![NPM version][npm-image]][npm-url]
|
||||
[![NPM downloads][downloads-image]][downloads-url]
|
||||
[![Build status][travis-image]][travis-url]
|
||||
[![Test coverage][coveralls-image]][coveralls-url]
|
||||
|
||||
**Popsicle** is the easiest way to make HTTP requests - offering a consistent, intuitive and light-weight API that works on node and the browser.
|
||||
|
||||
```js
|
||||
popsicle.get('/users.json')
|
||||
.then(function (res) {
|
||||
console.log(res.status) //=> 200
|
||||
console.log(res.body) //=> { ... }
|
||||
console.log(res.headers) //=> { ... }
|
||||
})
|
||||
```
|
||||
|
||||
## Installation
|
||||
|
||||
```
|
||||
npm install popsicle --save
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var popsicle = require('popsicle')
|
||||
|
||||
popsicle.request({
|
||||
method: 'POST',
|
||||
url: 'http://example.com/api/users',
|
||||
body: {
|
||||
username: 'blakeembrey',
|
||||
password: 'hunter2'
|
||||
},
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
}
|
||||
})
|
||||
.then(function (res) {
|
||||
console.log(res.status) // => 200
|
||||
console.log(res.body) //=> { ... }
|
||||
console.log(res.get('Content-Type')) //=> 'application/json'
|
||||
})
|
||||
```
|
||||
|
||||
**Popsicle** is ES6-ready, aliasing `default` to the default export. Try using `import popsicle from 'popsicle'` or import specific methods using `import { get, defaults } from 'popsicle'`. Exports:
|
||||
|
||||
* **request(options)** Default request handler - `defaults({})`
|
||||
* **get(options)** Alias of `request` (GET is the default method)
|
||||
* **del(options)** Alias of `defaults({ method: 'delete' })`
|
||||
* **head(options)** Alias of `defaults({ method: 'head' })`
|
||||
* **patch(options)** Alias of `defaults({ method: 'patch' })`
|
||||
* **post(options)** Alias of `defaults({ method: 'post' })`
|
||||
* **put(options)** Alias of `defaults({ method: 'put' })`
|
||||
* **default(options)** The ES6 default import, alias of `request`
|
||||
* **defaults(options)** Create a new Popsicle instance using `defaults`
|
||||
* **form(obj?)** Cross-platform form data object
|
||||
* **plugins** Exposes the default plugins (Object)
|
||||
* **jar(store?)** Create a cookie jar instance for Node.js
|
||||
* **transport** Default transportation layer (Object)
|
||||
* **browser** (boolean)
|
||||
* **Request(options)** Constructor for the `Request` class
|
||||
* **Response(options)** Constructor for the `Response` class
|
||||
|
||||
### Handling Requests
|
||||
|
||||
* **url** The resource location
|
||||
* **method** The HTTP request method (default: `"GET"`)
|
||||
* **headers** An object with HTTP headers, header name to value (default: `{}`)
|
||||
* **query** An object or string to be appended to the URL as the query string
|
||||
* **body** An object, string, form data, stream (node), etc to pass with the request
|
||||
* **timeout** The number of milliseconds to wait before aborting the request (default: `Infinity`)
|
||||
* **use** An array of plugins to be used (default: see below)
|
||||
* **options** Raw options used by the transport layer (default: `{}`)
|
||||
* **transport** Override the transportation layer (default: `http.request/https.request` (node), `XMLHttpRequest` (brower))
|
||||
|
||||
**Options using node transport**
|
||||
|
||||
The default plugins under node are `[stringify(), headers(), unzip(), concatStream('string'), parse()]`.
|
||||
|
||||
* **jar** An instance of a cookie jar (`popsicle.jar()`) (default: `null`)
|
||||
* **agent** Custom HTTP pooling agent (default: [infinity-agent](https://github.com/floatdrop/infinity-agent))
|
||||
* **maxRedirects** Override the number of redirects allowed (default: `5`)
|
||||
* **rejectUnauthorized** Reject invalid SSL certificates (default: `true`)
|
||||
* **followRedirects** Disable redirects or use a function to accept `307`/`308` redirects (default: `true`)
|
||||
* **ca** A string, `Buffer` or array of strings or `Buffers` of trusted certificates in PEM format
|
||||
* **key** Private key to use for SSL (default: `null`)
|
||||
* **cert** Public x509 certificate to use (default: `null`)
|
||||
|
||||
**Options using browser transport**
|
||||
|
||||
The default plugins in the browser are `[stringify(), headers(), parse()]`. Notice that unzipping and stream parsing is not available in browsers.
|
||||
|
||||
* **withCredentials** Send cookies with CORS requests (default: `false`)
|
||||
* **responseType** Set the XHR `responseType` (default: `undefined`)
|
||||
|
||||
#### Short-hand Methods
|
||||
|
||||
Common methods have a short hand exported (created using `defaults({ method })`).
|
||||
|
||||
```js
|
||||
popsicle.get('http://example.com/api/users')
|
||||
popsicle.post('http://example.com/api/users')
|
||||
popsicle.put('http://example.com/api/users')
|
||||
popsicle.patch('http://example.com/api/users')
|
||||
popsicle.del('http://example.com/api/users')
|
||||
```
|
||||
|
||||
#### Extending with Defaults
|
||||
|
||||
Create a new request function with defaults pre-populated. Handy for a common cookie jar or transport to be used.
|
||||
|
||||
```js
|
||||
var cookiePopsicle = popsicle.defaults({ options: { jar: popsicle.jar() } })
|
||||
```
|
||||
|
||||
#### Automatically Stringify Request Body
|
||||
|
||||
Popsicle can automatically serialize the request body using the built-in `stringify` plugin. If an object is supplied, it will automatically be stringified as JSON unless the `Content-Type` was set otherwise. If the `Content-Type` is `multipart/form-data` or `application/x-www-form-urlencoded`, it will be automatically serialized.
|
||||
|
||||
```js
|
||||
popsicle.get({
|
||||
url: 'http://example.com/api/users',
|
||||
body: {
|
||||
username: 'blakeembrey'
|
||||
},
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
#### Multipart Request Bodies
|
||||
|
||||
You can manually create form data by calling `popsicle.form`. When you pass a form data instance as the body, it'll automatically set the correct `Content-Type` - complete with boundary.
|
||||
|
||||
```js
|
||||
var form = popsicle.form({
|
||||
username: 'blakeembrey',
|
||||
profileImage: fs.createReadStream('image.png')
|
||||
})
|
||||
|
||||
popsicle.post({
|
||||
url: '/users',
|
||||
body: form
|
||||
})
|
||||
```
|
||||
|
||||
#### Aborting Requests
|
||||
|
||||
All requests can be aborted before or during execution by calling `Request#abort`.
|
||||
|
||||
```js
|
||||
var request = popsicle.get('http://example.com')
|
||||
|
||||
setTimeout(function () {
|
||||
request.abort()
|
||||
}, 100)
|
||||
|
||||
request.catch(function (err) {
|
||||
console.log(err) //=> { message: 'Request aborted', code: 'EABORTED' }
|
||||
})
|
||||
```
|
||||
|
||||
#### Progress
|
||||
|
||||
The request object can be used to check progress at any time.
|
||||
|
||||
* **request.uploadedBytes** Current upload size in bytes
|
||||
* **request.uploadLength** Total upload size in bytes
|
||||
* **request.uploaded** Total uploaded as a percentage
|
||||
* **request.downloadedBytes** Current download size in bytes
|
||||
* **request.downloadLength** Total download size in bytes
|
||||
* **request.downloaded** Total downloaded as a percentage
|
||||
* **request.completed** Total uploaded and downloaded as a percentage
|
||||
|
||||
All percentage properties (`request.uploaded`, `request.downloaded`, `request.completed`) are a number between `0` and `1`. Aborting the request will emit a progress event, if the request had started.
|
||||
|
||||
```js
|
||||
var request = popsicle.get('http://example.com')
|
||||
|
||||
request.uploaded //=> 0
|
||||
request.downloaded //=> 0
|
||||
|
||||
request.progress(function () {
|
||||
console.log(request) //=> { uploaded: 1, downloaded: 0, completed: 0.5, aborted: false }
|
||||
})
|
||||
|
||||
request.then(function (response) {
|
||||
console.log(request.downloaded) //=> 1
|
||||
})
|
||||
```
|
||||
|
||||
#### Default Plugins
|
||||
|
||||
The default plugins are exposed under `popsicle.plugins`, which allows you to mix, match and omit some plugins for maximum usability with any use-case.
|
||||
|
||||
```js
|
||||
{
|
||||
headers: [Function: headers],
|
||||
stringify: [Function: stringify],
|
||||
parse: [Function: parse],
|
||||
unzip: [Function: unzip],
|
||||
concatStream: [Function: concatStream],
|
||||
defaults: [
|
||||
[Function],
|
||||
[Function],
|
||||
[Function],
|
||||
[Function],
|
||||
[Function]
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
* **headers** Sets default headers, such as `User-Agent`, `Accept`, `Content-Length` (Highly recommended)
|
||||
* **stringify** Stringify object bodies into JSON/form data/url encoding (Recommended)
|
||||
* **parse** Automatically parse JSON and url encoding responses
|
||||
* **unzip** Automatically unzip response streams (Node only)
|
||||
* **concatStream** Buffer the stream using [concat-stream](https://www.npmjs.com/package/concat-stream) - accepts an "encoding" type (`string` (default), `buffer`, `array`, `uint8array`, `object`) (Node only)
|
||||
|
||||
#### Cookie Jar (Node only)
|
||||
|
||||
You can create a reusable cookie jar instance for requests by calling `popsicle.jar`.
|
||||
|
||||
```js
|
||||
var jar = popsicle.jar()
|
||||
|
||||
popsicle.request({
|
||||
method: 'post',
|
||||
url: '/users',
|
||||
options: {
|
||||
jar: jar
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
### Handling Responses
|
||||
|
||||
Promises and node-style callbacks are both supported.
|
||||
|
||||
#### Promises
|
||||
|
||||
Promises are the most expressive interface. Just chain using `Request#then` or `Request#catch` and continue.
|
||||
|
||||
```js
|
||||
popsicle.get('/users')
|
||||
.then(function (res) {
|
||||
// Success!
|
||||
})
|
||||
.catch(function (err) {
|
||||
// Something broke.
|
||||
})
|
||||
```
|
||||
|
||||
If you live on the edge, try using it with generators (see [co](https://www.npmjs.com/package/co)) or ES7's `async`.
|
||||
|
||||
```js
|
||||
co(function * () {
|
||||
yield popsicle.get('/users')
|
||||
})
|
||||
|
||||
async function () {
|
||||
await popsicle.get('/users')
|
||||
}
|
||||
```
|
||||
|
||||
#### Callbacks
|
||||
|
||||
For tooling that still expects node-style callbacks, you can use `Request#exec`. This accepts a single function to call when the response is complete.
|
||||
|
||||
```js
|
||||
popsicle.get('/users')
|
||||
.exec(function (err, res) {
|
||||
if (err) {
|
||||
// Something broke.
|
||||
}
|
||||
|
||||
// Success!
|
||||
})
|
||||
```
|
||||
|
||||
### Response Objects
|
||||
|
||||
Every Popsicle response will give a `Response` object on success. The object provides an intuitive interface for requesting common properties.
|
||||
|
||||
* **status** The HTTP response status code
|
||||
* **body** An object (if parsed using a plugin), string (if using concat) or stream that is the HTTP response body
|
||||
* **headers** An object of lower-cased keys to header values
|
||||
* **url** The response URL after redirects (only supported in browser with `responseURL`)
|
||||
* **statusType()** Return an integer with the HTTP status type (E.g. `200 -> 2`)
|
||||
* **get(key)** Retrieve a HTTP header using a case-insensitive key
|
||||
* **name(key)** Retrieve the original HTTP header name using a case-insensitive key
|
||||
* **type()** Return the response type (E.g. `application/json`)
|
||||
|
||||
### Error Handling
|
||||
|
||||
All response handling methods can return an error. Errors have a `popsicle` property set to the request object and a `code` string. The built-in codes are documented below, but custom errors can be created using `request.error(message, code, cause)`.
|
||||
|
||||
* **EABORT** Request has been aborted by user
|
||||
* **EUNAVAILABLE** Unable to connect to the remote URL
|
||||
* **EINVALID** Request URL is invalid
|
||||
* **ETIMEOUT** Request has exceeded the allowed timeout
|
||||
* **ESTRINGIFY** Request body threw an error during stringification plugin
|
||||
* **EPARSE** Response body threw an error during parsing plugin
|
||||
* **EMAXREDIRECTS** Maximum number of redirects exceeded (Node only)
|
||||
* **EBODY** Unable to handle request body (Node only)
|
||||
* **EBLOCKED** The request was blocked (HTTPS -> HTTP) (Browsers only)
|
||||
* **ECSP** Request violates the documents Content Security Policy (Browsers only)
|
||||
|
||||
### Plugins
|
||||
|
||||
Plugins can be passed in as an array with the initial options (which overrides default plugins), or they can be used via the chained method `Request#use`.
|
||||
|
||||
#### External Plugins
|
||||
|
||||
* [Server](https://github.com/blakeembrey/popsicle-server) - Automatically mount a server on an available for the request (helpful for testing a la `supertest`)
|
||||
* [Status](https://github.com/blakeembrey/popsicle-status) - Reject responses on HTTP failure status codes
|
||||
* [Cache](https://github.com/blakeembrey/popsicle-cache) - Built-in cache handling of HTTP requests under node (customizable store, uses a filesystem store by default)
|
||||
* [No Cache](https://github.com/blakeembrey/popsicle-no-cache) - Prevent caching of HTTP requests in browsers
|
||||
* [Basic Auth](https://github.com/blakeembrey/popsicle-basic-auth) - Add a basic authentication header to each request
|
||||
* [Prefix](https://github.com/blakeembrey/popsicle-prefix) - Prefix all HTTP requests
|
||||
* [Resolve](https://github.com/blakeembrey/popsicle-resolve) - Resolve all HTTP requests against a base URL
|
||||
* [Constants](https://github.com/blakeembrey/popsicle-constants) - Replace constants in the URL string
|
||||
* [Limit](https://github.com/blakeembrey/popsicle-limit) - Transparently handle API rate limits by grouping requests
|
||||
* [Group](https://github.com/blakeembrey/popsicle-group) - Group requests and perform operations on them all at once
|
||||
* [Proxy Agent](https://github.com/blakeembrey/popsicle-proxy-agent) - Enable HTTP(s) proxying under node (with environment variable support)
|
||||
* [Retry](https://github.com/blakeembrey/popsicle-retry) - Retry a HTTP request on network error or server error
|
||||
|
||||
#### Creating Plugins
|
||||
|
||||
Plugins must be a function that accepts configuration and returns another function. For example, here's a basic URL prefix plugin.
|
||||
|
||||
```js
|
||||
function prefix (url) {
|
||||
return function (self) {
|
||||
request.url = url + req.url
|
||||
}
|
||||
}
|
||||
|
||||
popsicle.request('/user')
|
||||
.use(prefix('http://example.com'))
|
||||
.then(function (response) {
|
||||
console.log(response.url) //=> "http://example.com/user"
|
||||
})
|
||||
```
|
||||
|
||||
Popsicle also has a way modify the request and response lifecycle, if needed. Any registered function can return a promise to defer the request or response resolution. This makes plugins such as rate-limiting and response body concatenation possible.
|
||||
|
||||
* **before(fn)** Register a function to run before the request is made
|
||||
* **after(fn)** Register a function to receive the response object
|
||||
* **always(fn)** Register a function that always runs on `resolve` or `reject`
|
||||
|
||||
**Tip:** Use the lifecycle hooks (above) when you want re-use (E.g. re-use when the request is cloned or options re-used).
|
||||
|
||||
#### Checking The Environment
|
||||
|
||||
```js
|
||||
popsicle.browser //=> true
|
||||
```
|
||||
|
||||
#### Transportation Layers
|
||||
|
||||
Creating a custom transportation layer is just a matter creating an object with `open`, `abort` and `use` options set. The open method should set any request information required between called as `request.raw`. Abort must abort the current request instance, while `open` must **always** resolve the promise. You can set `use` to an empty array if no plugins should be used by default. However, it's recommended you keep `use` set to the defaults, or as close as possible using your transport layer.
|
||||
|
||||
## TypeScript
|
||||
|
||||
This project is written using [TypeScript](https://github.com/Microsoft/TypeScript) and [typings](https://github.com/typings/typings). From version `1.3.1`, you can install the type definition using `typings`.
|
||||
|
||||
```
|
||||
typings install npm:popsicle --save
|
||||
```
|
||||
|
||||
## Development
|
||||
|
||||
Install dependencies and run the test runners (node and Electron using Tape).
|
||||
|
||||
```
|
||||
npm install && npm test
|
||||
```
|
||||
|
||||
## Related Projects
|
||||
|
||||
* [Superagent](https://github.com/visionmedia/superagent) - HTTP requests for node and browsers
|
||||
* [Fetch](https://github.com/github/fetch) - Browser polyfill for promise-based HTTP requests
|
||||
* [Axios](https://github.com/mzabriskie/axios) - HTTP request API based on Angular's $http service
|
||||
|
||||
## License
|
||||
|
||||
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
|
30
node_modules/popsicle/dist/base.d.ts
generated
vendored
Normal file
30
node_modules/popsicle/dist/base.d.ts
generated
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
import { Url } from 'url';
|
||||
export interface Query {
|
||||
[key: string]: string | string[];
|
||||
}
|
||||
export interface Headers {
|
||||
[name: string]: string | string[];
|
||||
}
|
||||
export declare type RawHeaders = string[];
|
||||
export interface BaseOptions {
|
||||
url?: string;
|
||||
query?: string | Query;
|
||||
headers?: Headers;
|
||||
rawHeaders?: RawHeaders;
|
||||
}
|
||||
export default class Base {
|
||||
Url: Url;
|
||||
rawHeaders: RawHeaders;
|
||||
constructor({url, headers, rawHeaders, query}: BaseOptions);
|
||||
url: string;
|
||||
query: string | Query;
|
||||
headers: Headers;
|
||||
toHeaders(): Headers;
|
||||
set(name: string, value: string | string[]): Base;
|
||||
append(name: string, value: string | string[]): this;
|
||||
name(name: string): string;
|
||||
get(name: string): string;
|
||||
remove(name: string): this;
|
||||
type(): string;
|
||||
type(value: string): Base;
|
||||
}
|
150
node_modules/popsicle/dist/base.js
generated
vendored
Normal file
150
node_modules/popsicle/dist/base.js
generated
vendored
Normal file
@ -0,0 +1,150 @@
|
||||
var url_1 = require('url');
|
||||
var querystring_1 = require('querystring');
|
||||
var extend = require('xtend');
|
||||
function lowerHeader(key) {
|
||||
var lower = key.toLowerCase();
|
||||
if (lower === 'referrer') {
|
||||
return 'referer';
|
||||
}
|
||||
return lower;
|
||||
}
|
||||
function type(str) {
|
||||
return str == null ? null : str.split(/ *; */)[0];
|
||||
}
|
||||
function concat(a, b) {
|
||||
if (a == null) {
|
||||
return b;
|
||||
}
|
||||
return Array.isArray(a) ? a.concat(b) : [a, b];
|
||||
}
|
||||
var Base = (function () {
|
||||
function Base(_a) {
|
||||
var url = _a.url, headers = _a.headers, rawHeaders = _a.rawHeaders, query = _a.query;
|
||||
this.Url = {};
|
||||
this.rawHeaders = [];
|
||||
if (url != null) {
|
||||
this.url = url;
|
||||
}
|
||||
if (query != null) {
|
||||
this.query = extend(this.query, typeof query === 'string' ? querystring_1.parse(query) : query);
|
||||
}
|
||||
if (rawHeaders) {
|
||||
if (rawHeaders.length % 2 === 1) {
|
||||
throw new TypeError("Expected raw headers length to be even, was " + rawHeaders.length);
|
||||
}
|
||||
this.rawHeaders = rawHeaders.slice(0);
|
||||
}
|
||||
else {
|
||||
this.headers = headers;
|
||||
}
|
||||
}
|
||||
Object.defineProperty(Base.prototype, "url", {
|
||||
get: function () {
|
||||
return url_1.format(this.Url);
|
||||
},
|
||||
set: function (url) {
|
||||
this.Url = url_1.parse(url, true, true);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(Base.prototype, "query", {
|
||||
get: function () {
|
||||
return this.Url.query;
|
||||
},
|
||||
set: function (query) {
|
||||
this.Url.query = typeof query === 'string' ? querystring_1.parse(query) : query;
|
||||
this.Url.search = null;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(Base.prototype, "headers", {
|
||||
get: function () {
|
||||
var headers = {};
|
||||
for (var i = 0; i < this.rawHeaders.length; i += 2) {
|
||||
var key = lowerHeader(this.rawHeaders[i]);
|
||||
var value = concat(headers[key], this.rawHeaders[i + 1]);
|
||||
headers[key] = value;
|
||||
}
|
||||
return headers;
|
||||
},
|
||||
set: function (headers) {
|
||||
this.rawHeaders = [];
|
||||
if (headers) {
|
||||
for (var _i = 0, _a = Object.keys(headers); _i < _a.length; _i++) {
|
||||
var key = _a[_i];
|
||||
this.append(key, headers[key]);
|
||||
}
|
||||
}
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Base.prototype.toHeaders = function () {
|
||||
var headers = {};
|
||||
for (var i = 0; i < this.rawHeaders.length; i += 2) {
|
||||
var key = this.rawHeaders[i];
|
||||
var value = concat(headers[key], this.rawHeaders[i + 1]);
|
||||
headers[key] = value;
|
||||
}
|
||||
return headers;
|
||||
};
|
||||
Base.prototype.set = function (name, value) {
|
||||
this.remove(name);
|
||||
this.append(name, value);
|
||||
return this;
|
||||
};
|
||||
Base.prototype.append = function (name, value) {
|
||||
if (Array.isArray(value)) {
|
||||
for (var _i = 0; _i < value.length; _i++) {
|
||||
var v = value[_i];
|
||||
this.rawHeaders.push(name, v);
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.rawHeaders.push(name, value);
|
||||
}
|
||||
return this;
|
||||
};
|
||||
Base.prototype.name = function (name) {
|
||||
var lowered = lowerHeader(name);
|
||||
var headerName;
|
||||
for (var i = 0; i < this.rawHeaders.length; i += 2) {
|
||||
if (lowerHeader(this.rawHeaders[i]) === lowered) {
|
||||
headerName = this.rawHeaders[i];
|
||||
}
|
||||
}
|
||||
return headerName;
|
||||
};
|
||||
Base.prototype.get = function (name) {
|
||||
var lowered = lowerHeader(name);
|
||||
var value;
|
||||
for (var i = 0; i < this.rawHeaders.length; i += 2) {
|
||||
if (lowerHeader(this.rawHeaders[i]) === lowered) {
|
||||
value = value == null ? this.rawHeaders[i + 1] : value + ", " + this.rawHeaders[i + 1];
|
||||
}
|
||||
}
|
||||
return value;
|
||||
};
|
||||
Base.prototype.remove = function (name) {
|
||||
var lowered = lowerHeader(name);
|
||||
var len = this.rawHeaders.length;
|
||||
while ((len -= 2) >= 0) {
|
||||
if (lowerHeader(this.rawHeaders[len]) === lowered) {
|
||||
this.rawHeaders.splice(len, 2);
|
||||
}
|
||||
}
|
||||
return this;
|
||||
};
|
||||
Base.prototype.type = function (value) {
|
||||
if (arguments.length === 0) {
|
||||
return type(this.get('Content-Type'));
|
||||
}
|
||||
return this.set('Content-Type', value);
|
||||
};
|
||||
return Base;
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = Base;
|
||||
//# sourceMappingURL=base.js.map
|
1
node_modules/popsicle/dist/base.js.map
generated
vendored
Normal file
1
node_modules/popsicle/dist/base.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
6
node_modules/popsicle/dist/browser.d.ts
generated
vendored
Normal file
6
node_modules/popsicle/dist/browser.d.ts
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
import Promise = require('any-promise');
|
||||
import Request from './request';
|
||||
import { defaults as use } from './plugins/index';
|
||||
export { open, abort, use };
|
||||
declare function open(request: Request): Promise<{}>;
|
||||
declare function abort(request: Request): void;
|
87
node_modules/popsicle/dist/browser.js
generated
vendored
Normal file
87
node_modules/popsicle/dist/browser.js
generated
vendored
Normal file
@ -0,0 +1,87 @@
|
||||
var Promise = require('any-promise');
|
||||
var index_1 = require('./plugins/index');
|
||||
exports.use = index_1.defaults;
|
||||
function open(request) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
var url = request.url, method = request.method;
|
||||
var responseType = request.options.responseType;
|
||||
if (window.location.protocol === 'https:' && /^http\:/.test(url)) {
|
||||
return reject(request.error("The request to \"" + url + "\" was blocked", 'EBLOCKED'));
|
||||
}
|
||||
var xhr = request.raw = new XMLHttpRequest();
|
||||
xhr.onload = function () {
|
||||
return resolve({
|
||||
status: xhr.status === 1223 ? 204 : xhr.status,
|
||||
statusText: xhr.statusText,
|
||||
rawHeaders: parseToRawHeaders(xhr.getAllResponseHeaders()),
|
||||
body: responseType ? xhr.response : xhr.responseText,
|
||||
url: xhr.responseURL
|
||||
});
|
||||
};
|
||||
xhr.onabort = function () {
|
||||
return reject(request.error('Request aborted', 'EABORT'));
|
||||
};
|
||||
xhr.onerror = function () {
|
||||
return reject(request.error("Unable to connect to \"" + request.url + "\"", 'EUNAVAILABLE'));
|
||||
};
|
||||
xhr.onprogress = function (e) {
|
||||
if (e.lengthComputable) {
|
||||
request.downloadLength = e.total;
|
||||
}
|
||||
request.downloadedBytes = e.loaded;
|
||||
};
|
||||
if (method === 'GET' || method === 'HEAD' || !xhr.upload) {
|
||||
request.uploadLength = 0;
|
||||
request.uploadedBytes = 0;
|
||||
}
|
||||
else {
|
||||
xhr.upload.onprogress = function (e) {
|
||||
if (e.lengthComputable) {
|
||||
request.uploadLength = e.total;
|
||||
}
|
||||
request.uploadedBytes = e.loaded;
|
||||
};
|
||||
}
|
||||
try {
|
||||
xhr.open(method, url);
|
||||
}
|
||||
catch (e) {
|
||||
return reject(request.error("Refused to connect to \"" + url + "\"", 'ECSP', e));
|
||||
}
|
||||
if (request.options.withCredentials) {
|
||||
xhr.withCredentials = true;
|
||||
}
|
||||
if (responseType) {
|
||||
try {
|
||||
xhr.responseType = responseType;
|
||||
}
|
||||
finally {
|
||||
if (xhr.responseType !== responseType) {
|
||||
throw request.error("Unsupported response type: " + responseType, 'ERESPONSETYPE');
|
||||
}
|
||||
}
|
||||
}
|
||||
for (var i = 0; i < request.rawHeaders.length; i += 2) {
|
||||
xhr.setRequestHeader(request.rawHeaders[i], request.rawHeaders[i + 1]);
|
||||
}
|
||||
xhr.send(request.body);
|
||||
});
|
||||
}
|
||||
exports.open = open;
|
||||
function abort(request) {
|
||||
request.raw.abort();
|
||||
}
|
||||
exports.abort = abort;
|
||||
function parseToRawHeaders(headers) {
|
||||
var rawHeaders = [];
|
||||
var lines = headers.replace(/\r?\n$/, '').split(/\r?\n/);
|
||||
for (var _i = 0; _i < lines.length; _i++) {
|
||||
var header = lines[_i];
|
||||
var indexOf = header.indexOf(':');
|
||||
var name_1 = header.substr(0, indexOf).trim();
|
||||
var value = header.substr(indexOf + 1).trim();
|
||||
rawHeaders.push(name_1, value);
|
||||
}
|
||||
return rawHeaders;
|
||||
}
|
||||
//# sourceMappingURL=browser.js.map
|
1
node_modules/popsicle/dist/browser.js.map
generated
vendored
Normal file
1
node_modules/popsicle/dist/browser.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"browser.js","sourceRoot":"","sources":["../lib/browser.ts"],"names":["open","abort","parseToRawHeaders"],"mappings":"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"}
|
1
node_modules/popsicle/dist/browser/form-data.d.ts
generated
vendored
Normal file
1
node_modules/popsicle/dist/browser/form-data.d.ts
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
export = FormData;
|
2
node_modules/popsicle/dist/browser/form-data.js
generated
vendored
Normal file
2
node_modules/popsicle/dist/browser/form-data.js
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
module.exports = FormData;
|
||||
//# sourceMappingURL=form-data.js.map
|
1
node_modules/popsicle/dist/browser/form-data.js.map
generated
vendored
Normal file
1
node_modules/popsicle/dist/browser/form-data.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"form-data.js","sourceRoot":"","sources":["../../lib/browser/form-data.ts"],"names":[],"mappings":"AAAA,iBAAS,QAAQ,CAAA"}
|
3
node_modules/popsicle/dist/browser/tough-cookie.d.ts
generated
vendored
Normal file
3
node_modules/popsicle/dist/browser/tough-cookie.d.ts
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
export declare class CookieJar {
|
||||
constructor();
|
||||
}
|
8
node_modules/popsicle/dist/browser/tough-cookie.js
generated
vendored
Normal file
8
node_modules/popsicle/dist/browser/tough-cookie.js
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
var CookieJar = (function () {
|
||||
function CookieJar() {
|
||||
throw new TypeError('Cookie jars are only available on node');
|
||||
}
|
||||
return CookieJar;
|
||||
})();
|
||||
exports.CookieJar = CookieJar;
|
||||
//# sourceMappingURL=tough-cookie.js.map
|
1
node_modules/popsicle/dist/browser/tough-cookie.js.map
generated
vendored
Normal file
1
node_modules/popsicle/dist/browser/tough-cookie.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"tough-cookie.js","sourceRoot":"","sources":["../../lib/browser/tough-cookie.ts"],"names":["CookieJar","CookieJar.constructor"],"mappings":"AAAA;IACEA;QACEC,MAAMA,IAAIA,SAASA,CAACA,wCAAwCA,CAACA,CAAAA;IAC/DA,CAACA;IACHD,gBAACA;AAADA,CAACA,AAJD,IAIC;AAJY,iBAAS,YAIrB,CAAA"}
|
18
node_modules/popsicle/dist/common.d.ts
generated
vendored
Normal file
18
node_modules/popsicle/dist/common.d.ts
generated
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
import Request, { RequestOptions, DefaultsOptions } from './request';
|
||||
import Response from './response';
|
||||
import * as plugins from './plugins/index';
|
||||
import form from './form';
|
||||
import jar from './jar';
|
||||
import PopsicleError from './error';
|
||||
import * as transport from './index';
|
||||
export declare function defaults(defaultsOptions: DefaultsOptions): (options: RequestOptions | string) => Request;
|
||||
export declare const browser: boolean;
|
||||
export declare const request: (options: RequestOptions | string) => Request;
|
||||
export declare const get: (options: RequestOptions | string) => Request;
|
||||
export declare const post: (options: RequestOptions | string) => Request;
|
||||
export declare const put: (options: RequestOptions | string) => Request;
|
||||
export declare const patch: (options: RequestOptions | string) => Request;
|
||||
export declare const del: (options: RequestOptions | string) => Request;
|
||||
export declare const head: (options: RequestOptions | string) => Request;
|
||||
export { Request, Response, PopsicleError, plugins, form, jar, transport };
|
||||
export default request;
|
43
node_modules/popsicle/dist/common.js
generated
vendored
Normal file
43
node_modules/popsicle/dist/common.js
generated
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
var extend = require('xtend');
|
||||
var request_1 = require('./request');
|
||||
exports.Request = request_1.default;
|
||||
var response_1 = require('./response');
|
||||
exports.Response = response_1.default;
|
||||
var plugins = require('./plugins/index');
|
||||
exports.plugins = plugins;
|
||||
var form_1 = require('./form');
|
||||
exports.form = form_1.default;
|
||||
var jar_1 = require('./jar');
|
||||
exports.jar = jar_1.default;
|
||||
var error_1 = require('./error');
|
||||
exports.PopsicleError = error_1.default;
|
||||
var transport = require('./index');
|
||||
exports.transport = transport;
|
||||
function defaults(defaultsOptions) {
|
||||
var defaults = extend({ transport: transport }, defaultsOptions);
|
||||
return function popsicle(options) {
|
||||
var opts;
|
||||
if (typeof options === 'string') {
|
||||
opts = extend(defaults, { url: options });
|
||||
}
|
||||
else {
|
||||
opts = extend(defaults, options);
|
||||
}
|
||||
if (typeof opts.url !== 'string') {
|
||||
throw new TypeError('The URL must be a string');
|
||||
}
|
||||
return new request_1.default(opts);
|
||||
};
|
||||
}
|
||||
exports.defaults = defaults;
|
||||
exports.browser = !!process.browser;
|
||||
exports.request = defaults({});
|
||||
exports.get = defaults({ method: 'get' });
|
||||
exports.post = defaults({ method: 'post' });
|
||||
exports.put = defaults({ method: 'put' });
|
||||
exports.patch = defaults({ method: 'patch' });
|
||||
exports.del = defaults({ method: 'delete' });
|
||||
exports.head = defaults({ method: 'head' });
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = exports.request;
|
||||
//# sourceMappingURL=common.js.map
|
1
node_modules/popsicle/dist/common.js.map
generated
vendored
Normal file
1
node_modules/popsicle/dist/common.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"common.js","sourceRoot":"","sources":["../lib/common.ts"],"names":["defaults","defaults.popsicle"],"mappings":"AAAA,IAAO,MAAM,WAAW,OAAO,CAAC,CAAA;AAChC,wBAAyD,WACzD,CAAC,CADmE;AAyC3D,eAAO;AAxChB,yBAAqB,YACrB,CAAC,CADgC;AAwCf,gBAAQ;AAvC1B,IAAY,OAAO,WAAM,iBACzB,CAAC,CADyC;AAuCC,eAAO;AAtClD,qBAAiB,QACjB,CAAC,CADwB;AAsC2B,YAAI;AArCxD,oBAAgB,OAChB,CAAC,CADsB;AAqCmC,WAAG;AApC7D,sBAA0B,SAC1B,CAAC,CADkC;AAoCP,qBAAa;AAnCzC,IAAY,SAAS,WAAM,SAK3B,CAAC,CALmC;AAmC2B,iBAAS;AA9BxE,kBAA0B,eAAgC;IACxDA,IAAMA,QAAQA,GAAGA,MAAMA,CAACA,EAAEA,WAAAA,SAASA,EAAEA,EAAEA,eAAeA,CAACA,CAAAA;IAEvDA,MAAMA,CAACA,kBAAmBA,OAAgCA;QACxDC,IAAIA,IAAoBA,CAAAA;QAExBA,EAAEA,CAACA,CAACA,OAAOA,OAAOA,KAAKA,QAAQA,CAACA,CAACA,CAACA;YAChCA,IAAIA,GAAGA,MAAMA,CAACA,QAAQA,EAAEA,EAAEA,GAAGA,EAAEA,OAAOA,EAAEA,CAACA,CAAAA;QAC3CA,CAACA;QAACA,IAAIA,CAACA,CAACA;YACNA,IAAIA,GAAGA,MAAMA,CAACA,QAAQA,EAAEA,OAAOA,CAACA,CAAAA;QAClCA,CAACA;QAEDA,EAAEA,CAACA,CAACA,OAAOA,IAAIA,CAACA,GAAGA,KAAKA,QAAQA,CAACA,CAACA,CAACA;YACjCA,MAAMA,IAAIA,SAASA,CAACA,0BAA0BA,CAACA,CAAAA;QACjDA,CAACA;QAEDA,MAAMA,CAACA,IAAIA,iBAAOA,CAACA,IAAIA,CAACA,CAAAA;IAC1BA,CAACA,CAAAD;AACHA,CAACA;AAlBe,gBAAQ,WAkBvB,CAAA;AAEY,eAAO,GAAG,CAAC,CAAC,OAAO,CAAC,OAAO,CAAA;AAC3B,eAAO,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAA;AAEtB,WAAG,GAAG,QAAQ,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAA;AACjC,YAAI,GAAG,QAAQ,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAA;AACnC,WAAG,GAAG,QAAQ,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAA;AACjC,aAAK,GAAG,QAAQ,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAA;AACrC,WAAG,GAAG,QAAQ,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAA;AACpC,YAAI,GAAG,QAAQ,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAA;AAIhD;kBAAe,eAAO,CAAA"}
|
8
node_modules/popsicle/dist/error.d.ts
generated
vendored
Normal file
8
node_modules/popsicle/dist/error.d.ts
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
import makeErrorCause = require('make-error-cause');
|
||||
import Request from './request';
|
||||
export default class PopsicleError extends makeErrorCause.BaseError {
|
||||
code: string;
|
||||
popsicle: Request;
|
||||
name: string;
|
||||
constructor(message: string, code: string, original: Error, popsicle: Request);
|
||||
}
|
19
node_modules/popsicle/dist/error.js
generated
vendored
Normal file
19
node_modules/popsicle/dist/error.js
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
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 makeErrorCause = require('make-error-cause');
|
||||
var PopsicleError = (function (_super) {
|
||||
__extends(PopsicleError, _super);
|
||||
function PopsicleError(message, code, original, popsicle) {
|
||||
_super.call(this, message, original);
|
||||
this.name = 'PopsicleError';
|
||||
this.code = code;
|
||||
this.popsicle = popsicle;
|
||||
}
|
||||
return PopsicleError;
|
||||
})(makeErrorCause.BaseError);
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = PopsicleError;
|
||||
//# sourceMappingURL=error.js.map
|
1
node_modules/popsicle/dist/error.js.map
generated
vendored
Normal file
1
node_modules/popsicle/dist/error.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"error.js","sourceRoot":"","sources":["../lib/error.ts"],"names":["PopsicleError","PopsicleError.constructor"],"mappings":";;;;;AAAA,IAAO,cAAc,WAAW,kBAAkB,CAAC,CAAA;AAGnD;IAA2CA,iCAAwBA;IAMjEA,uBAAaA,OAAeA,EAAEA,IAAYA,EAAEA,QAAeA,EAAEA,QAAiBA;QAC5EC,kBAAMA,OAAOA,EAAEA,QAAQA,CAACA,CAAAA;QAH1BA,SAAIA,GAAGA,eAAeA,CAAAA;QAKpBA,IAAIA,CAACA,IAAIA,GAAGA,IAAIA,CAAAA;QAChBA,IAAIA,CAACA,QAAQA,GAAGA,QAAQA,CAAAA;IAC1BA,CAACA;IAEHD,oBAACA;AAADA,CAACA,AAbD,EAA2C,cAAc,CAAC,SAAS,EAalE;AAbD;+BAaC,CAAA"}
|
2
node_modules/popsicle/dist/form.d.ts
generated
vendored
Normal file
2
node_modules/popsicle/dist/form.d.ts
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
import FormData = require('form-data');
|
||||
export default function form(obj: any): FormData;
|
13
node_modules/popsicle/dist/form.js
generated
vendored
Normal file
13
node_modules/popsicle/dist/form.js
generated
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
var FormData = require('form-data');
|
||||
function form(obj) {
|
||||
var form = new FormData();
|
||||
if (obj) {
|
||||
Object.keys(obj).forEach(function (name) {
|
||||
form.append(name, obj[name]);
|
||||
});
|
||||
}
|
||||
return form;
|
||||
}
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = form;
|
||||
//# sourceMappingURL=form.js.map
|
1
node_modules/popsicle/dist/form.js.map
generated
vendored
Normal file
1
node_modules/popsicle/dist/form.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"form.js","sourceRoot":"","sources":["../lib/form.ts"],"names":["form"],"mappings":"AAAA,IAAO,QAAQ,WAAW,WAAW,CAAC,CAAA;AAEtC,cAA8B,GAAQ;IACpCA,IAAMA,IAAIA,GAAGA,IAAIA,QAAQA,EAAEA,CAAAA;IAE3BA,EAAEA,CAACA,CAACA,GAAGA,CAACA,CAACA,CAACA;QACRA,MAAMA,CAACA,IAAIA,CAACA,GAAGA,CAACA,CAACA,OAAOA,CAACA,UAAUA,IAAIA;YACrC,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC,CAAA;QAC9B,CAAC,CAACA,CAAAA;IACJA,CAACA;IAEDA,MAAMA,CAACA,IAAIA,CAAAA;AACbA,CAACA;AAVD;sBAUC,CAAA"}
|
6
node_modules/popsicle/dist/index.d.ts
generated
vendored
Normal file
6
node_modules/popsicle/dist/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
import Promise = require('any-promise');
|
||||
import Request from './request';
|
||||
import { defaults as use } from './plugins/index';
|
||||
export { open, abort, use };
|
||||
declare function open(request: Request): Promise<{}>;
|
||||
declare function abort(request: Request): void;
|
171
node_modules/popsicle/dist/index.js
generated
vendored
Normal file
171
node_modules/popsicle/dist/index.js
generated
vendored
Normal file
@ -0,0 +1,171 @@
|
||||
var http_1 = require('http');
|
||||
var https_1 = require('https');
|
||||
var stream_1 = require('stream');
|
||||
var urlLib = require('url');
|
||||
var arrify = require('arrify');
|
||||
var Promise = require('any-promise');
|
||||
var index_1 = require('./plugins/index');
|
||||
exports.use = index_1.defaults;
|
||||
var REDIRECT_TYPE;
|
||||
(function (REDIRECT_TYPE) {
|
||||
REDIRECT_TYPE[REDIRECT_TYPE["FOLLOW_WITH_GET"] = 0] = "FOLLOW_WITH_GET";
|
||||
REDIRECT_TYPE[REDIRECT_TYPE["FOLLOW_WITH_CONFIRMATION"] = 1] = "FOLLOW_WITH_CONFIRMATION";
|
||||
})(REDIRECT_TYPE || (REDIRECT_TYPE = {}));
|
||||
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,
|
||||
'308': REDIRECT_TYPE.FOLLOW_WITH_CONFIRMATION
|
||||
};
|
||||
function open(request) {
|
||||
var url = request.url, method = request.method, body = request.body, options = request.options;
|
||||
var maxRedirects = num(options.maxRedirects, 5);
|
||||
var followRedirects = options.followRedirects !== false;
|
||||
var requestCount = 0;
|
||||
var confirmRedirect = typeof options.followRedirects === 'function' ?
|
||||
options.followRedirects : falsey;
|
||||
function get(url, method, body) {
|
||||
if (requestCount++ > maxRedirects) {
|
||||
return Promise.reject(request.error("Exceeded maximum of " + maxRedirects + " redirects", 'EMAXREDIRECTS'));
|
||||
}
|
||||
return appendCookies(request)
|
||||
.then(function () {
|
||||
return new Promise(function (resolve, reject) {
|
||||
var arg = urlLib.parse(url);
|
||||
var isHttp = arg.protocol !== 'https:';
|
||||
var engine = isHttp ? http_1.request : https_1.request;
|
||||
arg.method = method;
|
||||
arg.headers = request.toHeaders();
|
||||
arg.agent = options.agent;
|
||||
arg.rejectUnauthorized = options.rejectUnauthorized !== false;
|
||||
arg.ca = options.ca;
|
||||
arg.cert = options.cert;
|
||||
arg.key = options.key;
|
||||
var req = engine(arg);
|
||||
var requestProxy = new stream_1.PassThrough();
|
||||
var responseProxy = new stream_1.PassThrough();
|
||||
requestProxy.on('data', function (chunk) {
|
||||
request.uploadedBytes = request.uploadedBytes + chunk.length;
|
||||
});
|
||||
requestProxy.on('end', function () {
|
||||
request.uploadedBytes = request.uploadLength;
|
||||
});
|
||||
responseProxy.on('data', function (chunk) {
|
||||
request.downloadedBytes = request.downloadedBytes + chunk.length;
|
||||
});
|
||||
responseProxy.on('end', function () {
|
||||
request.downloadedBytes = request.downloadLength;
|
||||
});
|
||||
function response(res) {
|
||||
var status = res.statusCode;
|
||||
var redirect = REDIRECT_STATUS[status];
|
||||
if (followRedirects && redirect != null && res.headers.location) {
|
||||
var newUrl = urlLib.resolve(url, res.headers.location);
|
||||
res.resume();
|
||||
request.remove('Cookie');
|
||||
if (redirect === REDIRECT_TYPE.FOLLOW_WITH_GET) {
|
||||
request.set('Content-Length', '0');
|
||||
return get(newUrl, 'GET');
|
||||
}
|
||||
if (redirect === REDIRECT_TYPE.FOLLOW_WITH_CONFIRMATION) {
|
||||
if (arg.method === 'GET' || arg.method === 'HEAD') {
|
||||
return get(newUrl, method, body);
|
||||
}
|
||||
if (confirmRedirect(req, res)) {
|
||||
return get(newUrl, method, body);
|
||||
}
|
||||
}
|
||||
}
|
||||
request.downloadLength = num(res.headers['content-length'], 0);
|
||||
res.pipe(responseProxy);
|
||||
return Promise.resolve({
|
||||
body: responseProxy,
|
||||
status: status,
|
||||
statusText: res.statusMessage,
|
||||
headers: res.headers,
|
||||
rawHeaders: res.rawHeaders,
|
||||
url: url
|
||||
});
|
||||
}
|
||||
req.once('response', function (message) {
|
||||
return resolve(setCookies(request, message).then(function () { return response(message); }));
|
||||
});
|
||||
req.once('abort', function () {
|
||||
return reject(request.error('Request aborted', 'EABORT'));
|
||||
});
|
||||
req.once('error', function (error) {
|
||||
return reject(request.error("Unable to connect to \"" + url + "\"", 'EUNAVAILABLE', error));
|
||||
});
|
||||
requestProxy.once('error', reject);
|
||||
request.raw = req;
|
||||
request.uploadLength = num(req.getHeader('content-length'), 0);
|
||||
requestProxy.pipe(req);
|
||||
if (body) {
|
||||
if (typeof body.pipe === 'function') {
|
||||
body.pipe(requestProxy);
|
||||
}
|
||||
else {
|
||||
requestProxy.end(body);
|
||||
}
|
||||
}
|
||||
else {
|
||||
requestProxy.end();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
return get(url, method, body);
|
||||
}
|
||||
exports.open = open;
|
||||
function abort(request) {
|
||||
request.raw.abort();
|
||||
}
|
||||
exports.abort = abort;
|
||||
function num(value, fallback) {
|
||||
if (value == null) {
|
||||
return fallback;
|
||||
}
|
||||
return isNaN(value) ? fallback : Number(value);
|
||||
}
|
||||
function falsey() {
|
||||
return false;
|
||||
}
|
||||
function appendCookies(request) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
if (!request.options.jar) {
|
||||
return resolve();
|
||||
}
|
||||
request.options.jar.getCookies(request.url, function (err, cookies) {
|
||||
if (err) {
|
||||
return reject(err);
|
||||
}
|
||||
if (cookies.length) {
|
||||
request.append('Cookie', cookies.join('; '));
|
||||
}
|
||||
return resolve();
|
||||
});
|
||||
});
|
||||
}
|
||||
function setCookies(request, message) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
if (!request.options.jar) {
|
||||
return resolve();
|
||||
}
|
||||
var cookies = arrify(message.headers['set-cookie']);
|
||||
if (!cookies.length) {
|
||||
return resolve();
|
||||
}
|
||||
var setCookies = cookies.map(function (cookie) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
request.options.jar.setCookie(cookie, request.url, function (err) {
|
||||
return err ? reject(err) : resolve();
|
||||
});
|
||||
});
|
||||
});
|
||||
return resolve(Promise.all(setCookies));
|
||||
});
|
||||
}
|
||||
//# sourceMappingURL=index.js.map
|
1
node_modules/popsicle/dist/index.js.map
generated
vendored
Normal file
1
node_modules/popsicle/dist/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
2
node_modules/popsicle/dist/jar.d.ts
generated
vendored
Normal file
2
node_modules/popsicle/dist/jar.d.ts
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
import { CookieJar } from 'tough-cookie';
|
||||
export default function cookieJar(store?: any): CookieJar;
|
7
node_modules/popsicle/dist/jar.js
generated
vendored
Normal file
7
node_modules/popsicle/dist/jar.js
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
var tough_cookie_1 = require('tough-cookie');
|
||||
function cookieJar(store) {
|
||||
return new tough_cookie_1.CookieJar(store);
|
||||
}
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = cookieJar;
|
||||
//# sourceMappingURL=jar.js.map
|
1
node_modules/popsicle/dist/jar.js.map
generated
vendored
Normal file
1
node_modules/popsicle/dist/jar.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"jar.js","sourceRoot":"","sources":["../lib/jar.ts"],"names":["cookieJar"],"mappings":"AAAA,6BAA0B,cAE1B,CAAC,CAFuC;AAExC,mBAAmC,KAAW;IAC5CA,MAAMA,CAACA,IAAIA,wBAASA,CAACA,KAAKA,CAACA,CAAAA;AAC7BA,CAACA;AAFD;2BAEC,CAAA"}
|
3
node_modules/popsicle/dist/plugins/browser.d.ts
generated
vendored
Normal file
3
node_modules/popsicle/dist/plugins/browser.d.ts
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
export * from './common';
|
||||
import { Middleware } from '../request';
|
||||
export declare const defaults: Middleware[];
|
7
node_modules/popsicle/dist/plugins/browser.js
generated
vendored
Normal file
7
node_modules/popsicle/dist/plugins/browser.js
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
function __export(m) {
|
||||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
||||
}
|
||||
__export(require('./common'));
|
||||
var common_2 = require('./common');
|
||||
exports.defaults = [common_2.stringify(), common_2.headers(), common_2.parse()];
|
||||
//# sourceMappingURL=browser.js.map
|
1
node_modules/popsicle/dist/plugins/browser.js.map
generated
vendored
Normal file
1
node_modules/popsicle/dist/plugins/browser.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"browser.js","sourceRoot":"","sources":["../../lib/plugins/browser.ts"],"names":[],"mappings":";;;AAAA,iBAAc,UACd,CAAC,EADuB;AACxB,uBAA0C,UAC1C,CAAC,CADmD;AAGvC,gBAAQ,GAAiB,CAAC,kBAAS,EAAE,EAAE,gBAAO,EAAE,EAAE,cAAK,EAAE,CAAC,CAAA"}
|
4
node_modules/popsicle/dist/plugins/common.d.ts
generated
vendored
Normal file
4
node_modules/popsicle/dist/plugins/common.d.ts
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
import Request from '../request';
|
||||
export declare function headers(): (request: Request) => void;
|
||||
export declare function stringify(): (request: Request) => void;
|
||||
export declare function parse(): (request: Request) => void;
|
106
node_modules/popsicle/dist/plugins/common.js
generated
vendored
Normal file
106
node_modules/popsicle/dist/plugins/common.js
generated
vendored
Normal file
@ -0,0 +1,106 @@
|
||||
var Promise = require('any-promise');
|
||||
var FormData = require('form-data');
|
||||
var querystring_1 = require('querystring');
|
||||
var form_1 = require('../form');
|
||||
var JSON_MIME_REGEXP = /^application\/(?:[\w!#\$%&\*`\-\.\^~]*\+)?json$/i;
|
||||
var QUERY_MIME_REGEXP = /^application\/x-www-form-urlencoded$/i;
|
||||
var FORM_MIME_REGEXP = /^multipart\/form-data$/i;
|
||||
var isHostObject;
|
||||
if (process.browser) {
|
||||
isHostObject = function (object) {
|
||||
var str = Object.prototype.toString.call(object);
|
||||
switch (str) {
|
||||
case '[object File]':
|
||||
case '[object Blob]':
|
||||
case '[object FormData]':
|
||||
case '[object ArrayBuffer]':
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
||||
else {
|
||||
isHostObject = function (object) {
|
||||
return typeof object.pipe === 'function' || Buffer.isBuffer(object);
|
||||
};
|
||||
}
|
||||
function defaultHeaders(request) {
|
||||
if (!request.get('Accept')) {
|
||||
request.set('Accept', '*/*');
|
||||
}
|
||||
request.remove('Host');
|
||||
}
|
||||
function stringifyRequest(request) {
|
||||
var body = request.body;
|
||||
if (Object(body) !== body) {
|
||||
request.body = body == null ? null : String(body);
|
||||
return;
|
||||
}
|
||||
if (isHostObject(body)) {
|
||||
return;
|
||||
}
|
||||
var type = request.type();
|
||||
if (!type) {
|
||||
type = 'application/json';
|
||||
request.type(type);
|
||||
}
|
||||
try {
|
||||
if (JSON_MIME_REGEXP.test(type)) {
|
||||
request.body = JSON.stringify(body);
|
||||
}
|
||||
else if (FORM_MIME_REGEXP.test(type)) {
|
||||
request.body = form_1.default(body);
|
||||
}
|
||||
else if (QUERY_MIME_REGEXP.test(type)) {
|
||||
request.body = querystring_1.stringify(body);
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
return Promise.reject(request.error('Unable to stringify request body: ' + err.message, 'ESTRINGIFY', err));
|
||||
}
|
||||
if (request.body instanceof FormData) {
|
||||
request.remove('Content-Type');
|
||||
}
|
||||
}
|
||||
function parseResponse(response) {
|
||||
var body = response.body;
|
||||
if (typeof body !== 'string') {
|
||||
return;
|
||||
}
|
||||
if (body === '') {
|
||||
response.body = null;
|
||||
return;
|
||||
}
|
||||
var type = response.type();
|
||||
try {
|
||||
if (JSON_MIME_REGEXP.test(type)) {
|
||||
response.body = body === '' ? null : JSON.parse(body);
|
||||
}
|
||||
else if (QUERY_MIME_REGEXP.test(type)) {
|
||||
response.body = querystring_1.parse(body);
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
return Promise.reject(response.error('Unable to parse response body: ' + err.message, 'EPARSE', err));
|
||||
}
|
||||
}
|
||||
function headers() {
|
||||
return function (request) {
|
||||
request.before(defaultHeaders);
|
||||
};
|
||||
}
|
||||
exports.headers = headers;
|
||||
function stringify() {
|
||||
return function (request) {
|
||||
request.before(stringifyRequest);
|
||||
};
|
||||
}
|
||||
exports.stringify = stringify;
|
||||
function parse() {
|
||||
return function (request) {
|
||||
request.after(parseResponse);
|
||||
};
|
||||
}
|
||||
exports.parse = parse;
|
||||
//# sourceMappingURL=common.js.map
|
1
node_modules/popsicle/dist/plugins/common.js.map
generated
vendored
Normal file
1
node_modules/popsicle/dist/plugins/common.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../lib/plugins/common.ts"],"names":["defaultHeaders","stringifyRequest","parseResponse","headers","stringify","parse"],"mappings":"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"}
|
6
node_modules/popsicle/dist/plugins/index.d.ts
generated
vendored
Normal file
6
node_modules/popsicle/dist/plugins/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
export * from './common';
|
||||
import Request, { Middleware } from '../request';
|
||||
export declare function unzip(): (request: Request) => void;
|
||||
export declare function concatStream(encoding: string): (request: Request) => void;
|
||||
export declare function headers(): (request: Request) => void;
|
||||
export declare const defaults: Middleware[];
|
98
node_modules/popsicle/dist/plugins/index.js
generated
vendored
Normal file
98
node_modules/popsicle/dist/plugins/index.js
generated
vendored
Normal file
@ -0,0 +1,98 @@
|
||||
function __export(m) {
|
||||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
||||
}
|
||||
var concat = require('concat-stream');
|
||||
var FormData = require('form-data');
|
||||
var zlib_1 = require('zlib');
|
||||
var Promise = require('any-promise');
|
||||
__export(require('./common'));
|
||||
var common_2 = require('./common');
|
||||
function unzipResponse(response) {
|
||||
if (['gzip', 'deflate'].indexOf(response.get('Content-Encoding')) > -1) {
|
||||
var unzip_1 = zlib_1.createUnzip();
|
||||
response.body.pipe(unzip_1);
|
||||
response.body = unzip_1;
|
||||
}
|
||||
}
|
||||
function unzipHeaders(request) {
|
||||
if (!request.get('Accept-Encoding')) {
|
||||
request.set('Accept-Encoding', 'gzip,deflate');
|
||||
}
|
||||
}
|
||||
function unzip() {
|
||||
return function (request) {
|
||||
request.before(unzipHeaders);
|
||||
request.after(unzipResponse);
|
||||
};
|
||||
}
|
||||
exports.unzip = unzip;
|
||||
function concatStream(encoding) {
|
||||
return function (request) {
|
||||
request.after(function (response) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
var stream = concat({
|
||||
encoding: encoding
|
||||
}, function (data) {
|
||||
response.body = data;
|
||||
return resolve();
|
||||
});
|
||||
response.body.once('error', reject);
|
||||
response.body.pipe(stream);
|
||||
});
|
||||
});
|
||||
};
|
||||
}
|
||||
exports.concatStream = concatStream;
|
||||
function defaultHeaders(request) {
|
||||
if (!request.get('User-Agent')) {
|
||||
request.set('User-Agent', 'https://github.com/blakeembrey/popsicle');
|
||||
}
|
||||
if (request.body instanceof FormData) {
|
||||
request.set('Content-Type', 'multipart/form-data; boundary=' + request.body.getBoundary());
|
||||
return new Promise(function (resolve, reject) {
|
||||
request.body.getLength(function (err, length) {
|
||||
if (err) {
|
||||
request.set('Transfer-Encoding', 'chunked');
|
||||
}
|
||||
else {
|
||||
request.set('Content-Length', String(length));
|
||||
}
|
||||
return resolve();
|
||||
});
|
||||
});
|
||||
}
|
||||
var length = 0;
|
||||
var body = request.body;
|
||||
if (body && !request.get('Content-Length')) {
|
||||
if (Array.isArray(body)) {
|
||||
for (var i = 0; i < body.length; i++) {
|
||||
length += body[i].length;
|
||||
}
|
||||
}
|
||||
else if (typeof body === 'string') {
|
||||
length = Buffer.byteLength(body);
|
||||
}
|
||||
else {
|
||||
length = body.length;
|
||||
}
|
||||
if (length) {
|
||||
request.set('Content-Length', String(length));
|
||||
}
|
||||
else if (typeof body.pipe === 'function') {
|
||||
request.set('Transfer-Encoding', 'chunked');
|
||||
}
|
||||
else {
|
||||
return Promise.reject(request.error('Argument error, `options.body`', 'EBODY'));
|
||||
}
|
||||
}
|
||||
}
|
||||
function headers() {
|
||||
var defaults = common_2.headers();
|
||||
return function (request) {
|
||||
defaults(request);
|
||||
request.before(defaultHeaders);
|
||||
};
|
||||
}
|
||||
exports.headers = headers;
|
||||
exports.defaults = [common_2.stringify(), headers(), unzip(), concatStream('string'), common_2.parse()];
|
||||
//# sourceMappingURL=index.js.map
|
1
node_modules/popsicle/dist/plugins/index.js.map
generated
vendored
Normal file
1
node_modules/popsicle/dist/plugins/index.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/plugins/index.ts"],"names":["unzipResponse","unzipHeaders","unzip","concatStream","defaultHeaders","headers"],"mappings":"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"}
|
82
node_modules/popsicle/dist/request.d.ts
generated
vendored
Normal file
82
node_modules/popsicle/dist/request.d.ts
generated
vendored
Normal file
@ -0,0 +1,82 @@
|
||||
import Promise = require('any-promise');
|
||||
import Base, { BaseOptions, Headers } from './base';
|
||||
import Response, { ResponseOptions } from './response';
|
||||
import PopsicleError from './error';
|
||||
export interface DefaultsOptions extends BaseOptions {
|
||||
url?: string;
|
||||
method?: string;
|
||||
timeout?: number;
|
||||
body?: any;
|
||||
options?: any;
|
||||
use?: Middleware[];
|
||||
before?: RequestPluginFunction[];
|
||||
after?: ResponsePluginFunction[];
|
||||
always?: RequestPluginFunction[];
|
||||
progress?: RequestPluginFunction[];
|
||||
transport?: TransportOptions;
|
||||
}
|
||||
export interface RequestOptions extends DefaultsOptions {
|
||||
url: string;
|
||||
}
|
||||
export interface RequestJSON {
|
||||
url: string;
|
||||
headers: Headers;
|
||||
body: any;
|
||||
timeout: number;
|
||||
options: any;
|
||||
method: string;
|
||||
}
|
||||
export interface TransportOptions {
|
||||
open: OpenHandler;
|
||||
abort?: AbortHandler;
|
||||
use?: Middleware[];
|
||||
}
|
||||
export declare type Middleware = (request?: Request) => any;
|
||||
export declare type RequestPluginFunction = (request?: Request) => any;
|
||||
export declare type ResponsePluginFunction = (response?: Response) => any;
|
||||
export declare type OpenHandler = (request: Request) => Promise<ResponseOptions>;
|
||||
export declare type AbortHandler = (request: Request) => any;
|
||||
export default class Request extends Base implements Promise<Response> {
|
||||
method: string;
|
||||
timeout: number;
|
||||
body: any;
|
||||
options: any;
|
||||
response: Response;
|
||||
raw: any;
|
||||
errored: PopsicleError;
|
||||
transport: TransportOptions;
|
||||
aborted: boolean;
|
||||
timedout: boolean;
|
||||
opened: boolean;
|
||||
started: boolean;
|
||||
uploadLength: number;
|
||||
downloadLength: number;
|
||||
private _uploadedBytes;
|
||||
private _downloadedBytes;
|
||||
private _promise;
|
||||
private _before;
|
||||
private _after;
|
||||
private _always;
|
||||
private _progress;
|
||||
constructor(options: RequestOptions);
|
||||
use(fn: Middleware | Middleware[]): this;
|
||||
error(message: string, code: string, original?: Error): PopsicleError;
|
||||
then(onFulfilled: (response?: Response) => any, onRejected?: (error?: PopsicleError) => any): Promise<any>;
|
||||
catch(onRejected: (error?: PopsicleError) => any): Promise<any>;
|
||||
exec(cb: (err: PopsicleError, response?: Response) => any): void;
|
||||
toOptions(): RequestOptions;
|
||||
toJSON(): RequestJSON;
|
||||
clone(): Request;
|
||||
progress(fn: RequestPluginFunction | RequestPluginFunction[]): Request;
|
||||
before(fn: RequestPluginFunction | RequestPluginFunction[]): Request;
|
||||
after(fn: ResponsePluginFunction | ResponsePluginFunction[]): Request;
|
||||
always(fn: RequestPluginFunction | RequestPluginFunction[]): Request;
|
||||
abort(): this;
|
||||
uploaded: number;
|
||||
downloaded: number;
|
||||
completed: number;
|
||||
completedBytes: number;
|
||||
totalBytes: number;
|
||||
uploadedBytes: number;
|
||||
downloadedBytes: number;
|
||||
}
|
262
node_modules/popsicle/dist/request.js
generated
vendored
Normal file
262
node_modules/popsicle/dist/request.js
generated
vendored
Normal file
@ -0,0 +1,262 @@
|
||||
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 arrify = require('arrify');
|
||||
var extend = require('xtend');
|
||||
var Promise = require('any-promise');
|
||||
var base_1 = require('./base');
|
||||
var response_1 = require('./response');
|
||||
var error_1 = require('./error');
|
||||
var Request = (function (_super) {
|
||||
__extends(Request, _super);
|
||||
function Request(options) {
|
||||
var _this = this;
|
||||
_super.call(this, options);
|
||||
this.aborted = false;
|
||||
this.timedout = false;
|
||||
this.opened = false;
|
||||
this.started = false;
|
||||
this.uploadLength = null;
|
||||
this.downloadLength = null;
|
||||
this._uploadedBytes = null;
|
||||
this._downloadedBytes = null;
|
||||
this._before = [];
|
||||
this._after = [];
|
||||
this._always = [];
|
||||
this._progress = [];
|
||||
this.timeout = Number(options.timeout) || 0;
|
||||
this.method = (options.method || 'GET').toUpperCase();
|
||||
this.body = options.body;
|
||||
this.options = extend(options.options);
|
||||
this._promise = new Promise(function (resolve, reject) {
|
||||
process.nextTick(function () { return start(_this).then(resolve, reject); });
|
||||
});
|
||||
this.transport = extend(options.transport);
|
||||
this.use(options.use || this.transport.use);
|
||||
this.before(options.before);
|
||||
this.after(options.after);
|
||||
this.always(options.always);
|
||||
this.progress(options.progress);
|
||||
}
|
||||
Request.prototype.use = function (fn) {
|
||||
var _this = this;
|
||||
arrify(fn).forEach(function (fn) { return fn(_this); });
|
||||
return this;
|
||||
};
|
||||
Request.prototype.error = function (message, code, original) {
|
||||
return new error_1.default(message, code, original, this);
|
||||
};
|
||||
Request.prototype.then = function (onFulfilled, onRejected) {
|
||||
return this._promise.then(onFulfilled, onRejected);
|
||||
};
|
||||
Request.prototype.catch = function (onRejected) {
|
||||
return this.then(null, onRejected);
|
||||
};
|
||||
Request.prototype.exec = function (cb) {
|
||||
this.then(function (response) {
|
||||
cb(null, response);
|
||||
}, cb);
|
||||
};
|
||||
Request.prototype.toOptions = function () {
|
||||
return {
|
||||
url: this.url,
|
||||
method: this.method,
|
||||
options: this.options,
|
||||
use: [],
|
||||
body: this.body,
|
||||
transport: this.transport,
|
||||
timeout: this.timeout,
|
||||
rawHeaders: this.rawHeaders,
|
||||
before: this._before,
|
||||
after: this._after,
|
||||
progress: this._progress,
|
||||
always: this._always
|
||||
};
|
||||
};
|
||||
Request.prototype.toJSON = function () {
|
||||
return {
|
||||
url: this.url,
|
||||
headers: this.headers,
|
||||
body: this.body,
|
||||
options: this.options,
|
||||
timeout: this.timeout,
|
||||
method: this.method
|
||||
};
|
||||
};
|
||||
Request.prototype.clone = function () {
|
||||
return new Request(this.toOptions());
|
||||
};
|
||||
Request.prototype.progress = function (fn) {
|
||||
return pluginFunction(this, '_progress', fn);
|
||||
};
|
||||
Request.prototype.before = function (fn) {
|
||||
return pluginFunction(this, '_before', fn);
|
||||
};
|
||||
Request.prototype.after = function (fn) {
|
||||
return pluginFunction(this, '_after', fn);
|
||||
};
|
||||
Request.prototype.always = function (fn) {
|
||||
return pluginFunction(this, '_always', fn);
|
||||
};
|
||||
Request.prototype.abort = function () {
|
||||
if (this.completed === 1 || this.aborted) {
|
||||
return this;
|
||||
}
|
||||
this.aborted = true;
|
||||
this.errored = this.errored || this.error('Request aborted', 'EABORT');
|
||||
if (this.opened) {
|
||||
emitProgress(this);
|
||||
this._progress = null;
|
||||
if (this.transport.abort) {
|
||||
this.transport.abort(this);
|
||||
}
|
||||
}
|
||||
return this;
|
||||
};
|
||||
Object.defineProperty(Request.prototype, "uploaded", {
|
||||
get: function () {
|
||||
return this.uploadLength ? this.uploadedBytes / this.uploadLength : 0;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(Request.prototype, "downloaded", {
|
||||
get: function () {
|
||||
return this.downloadLength ? this.downloadedBytes / this.downloadLength : 0;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(Request.prototype, "completed", {
|
||||
get: function () {
|
||||
return (this.uploaded + this.downloaded) / 2;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(Request.prototype, "completedBytes", {
|
||||
get: function () {
|
||||
return this.uploadedBytes + this.downloadedBytes;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(Request.prototype, "totalBytes", {
|
||||
get: function () {
|
||||
return this.uploadLength + this.downloadLength;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(Request.prototype, "uploadedBytes", {
|
||||
get: function () {
|
||||
return this._uploadedBytes;
|
||||
},
|
||||
set: function (bytes) {
|
||||
if (bytes !== this._uploadedBytes) {
|
||||
this._uploadedBytes = bytes;
|
||||
emitProgress(this);
|
||||
}
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(Request.prototype, "downloadedBytes", {
|
||||
get: function () {
|
||||
return this._downloadedBytes;
|
||||
},
|
||||
set: function (bytes) {
|
||||
if (bytes !== this._downloadedBytes) {
|
||||
this._downloadedBytes = bytes;
|
||||
emitProgress(this);
|
||||
}
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
return Request;
|
||||
})(base_1.default);
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = Request;
|
||||
function pluginFunction(request, property, fns) {
|
||||
if (request.started) {
|
||||
throw new TypeError('Plugins can not be used after the request has started');
|
||||
}
|
||||
for (var _i = 0, _a = arrify(fns); _i < _a.length; _i++) {
|
||||
var fn = _a[_i];
|
||||
if (typeof fn !== 'function') {
|
||||
throw new TypeError("Expected a function, but got " + fn + " instead");
|
||||
}
|
||||
;
|
||||
request[property].push(fn);
|
||||
}
|
||||
return request;
|
||||
}
|
||||
function start(request) {
|
||||
var req = request;
|
||||
var timeout = request.timeout, url = request.url;
|
||||
var timer;
|
||||
request.started = true;
|
||||
if (request.errored) {
|
||||
return Promise.reject(request.errored);
|
||||
}
|
||||
if (/^https?\:\/*(?:[~#\\\?;\:]|$)/.test(url)) {
|
||||
return Promise.reject(request.error("Refused to connect to invalid URL \"" + url + "\"", 'EINVALID'));
|
||||
}
|
||||
return chain(req._before, request)
|
||||
.then(function () {
|
||||
if (request.errored) {
|
||||
return;
|
||||
}
|
||||
if (timeout) {
|
||||
timer = setTimeout(function () {
|
||||
var error = request.error("Timeout of " + request.timeout + "ms exceeded", 'ETIMEOUT');
|
||||
request.errored = error;
|
||||
request.timedout = true;
|
||||
request.abort();
|
||||
}, timeout);
|
||||
}
|
||||
req.opened = true;
|
||||
return req.transport.open(request)
|
||||
.then(function (options) {
|
||||
var response = new response_1.default(options);
|
||||
response.request = request;
|
||||
request.response = response;
|
||||
return chain(req._after, response);
|
||||
});
|
||||
})
|
||||
.then(function () { return chain(req._always, request); }, function (error) { return chain(req._always, request).then(function () { return Promise.reject(error); }); })
|
||||
.then(function () {
|
||||
if (request.errored) {
|
||||
return Promise.reject(request.errored);
|
||||
}
|
||||
return request.response;
|
||||
}, function (error) {
|
||||
request.errored = request.errored || error;
|
||||
return Promise.reject(request.errored);
|
||||
});
|
||||
}
|
||||
function chain(fns, arg) {
|
||||
return fns.reduce(function (p, fn) {
|
||||
return p.then(function () { return fn(arg); });
|
||||
}, Promise.resolve());
|
||||
}
|
||||
function emitProgress(request) {
|
||||
var fns = request._progress;
|
||||
if (!fns || request.errored) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
for (var _i = 0; _i < fns.length; _i++) {
|
||||
var fn = fns[_i];
|
||||
fn(request);
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
request.errored = err;
|
||||
request.abort();
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=request.js.map
|
1
node_modules/popsicle/dist/request.js.map
generated
vendored
Normal file
1
node_modules/popsicle/dist/request.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
26
node_modules/popsicle/dist/response.d.ts
generated
vendored
Normal file
26
node_modules/popsicle/dist/response.d.ts
generated
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
import Base, { BaseOptions, Headers, RawHeaders } from './base';
|
||||
import Request from './request';
|
||||
import PopsicleError from './error';
|
||||
export interface ResponseOptions extends BaseOptions {
|
||||
body: any;
|
||||
status: number;
|
||||
statusText: string;
|
||||
}
|
||||
export interface ResponseJSON {
|
||||
headers: Headers;
|
||||
rawHeaders: RawHeaders;
|
||||
body: any;
|
||||
url: string;
|
||||
status: number;
|
||||
statusText: string;
|
||||
}
|
||||
export default class Response extends Base {
|
||||
status: number;
|
||||
statusText: string;
|
||||
body: any;
|
||||
request: Request;
|
||||
constructor(options: ResponseOptions);
|
||||
statusType(): number;
|
||||
error(message: string, type: string, error?: Error): PopsicleError;
|
||||
toJSON(): ResponseJSON;
|
||||
}
|
35
node_modules/popsicle/dist/response.js
generated
vendored
Normal file
35
node_modules/popsicle/dist/response.js
generated
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
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 base_1 = require('./base');
|
||||
var Response = (function (_super) {
|
||||
__extends(Response, _super);
|
||||
function Response(options) {
|
||||
_super.call(this, options);
|
||||
this.body = options.body;
|
||||
this.status = options.status;
|
||||
this.statusText = options.statusText;
|
||||
}
|
||||
Response.prototype.statusType = function () {
|
||||
return ~~(this.status / 100);
|
||||
};
|
||||
Response.prototype.error = function (message, type, error) {
|
||||
return this.request.error(message, type, error);
|
||||
};
|
||||
Response.prototype.toJSON = function () {
|
||||
return {
|
||||
url: this.url,
|
||||
headers: this.headers,
|
||||
rawHeaders: this.rawHeaders,
|
||||
body: this.body,
|
||||
status: this.status,
|
||||
statusText: this.statusText
|
||||
};
|
||||
};
|
||||
return Response;
|
||||
})(base_1.default);
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = Response;
|
||||
//# sourceMappingURL=response.js.map
|
1
node_modules/popsicle/dist/response.js.map
generated
vendored
Normal file
1
node_modules/popsicle/dist/response.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"response.js","sourceRoot":"","sources":["../lib/response.ts"],"names":["Response","Response.constructor","Response.statusType","Response.error","Response.toJSON"],"mappings":";;;;;AAAA,qBAAuD,QACvD,CAAC,CAD8D;AAmB/D;IAAsCA,4BAAIA;IAMxCA,kBAAaA,OAAwBA;QACnCC,kBAAMA,OAAOA,CAACA,CAAAA;QAEdA,IAAIA,CAACA,IAAIA,GAAGA,OAAOA,CAACA,IAAIA,CAAAA;QACxBA,IAAIA,CAACA,MAAMA,GAAGA,OAAOA,CAACA,MAAMA,CAAAA;QAC5BA,IAAIA,CAACA,UAAUA,GAAGA,OAAOA,CAACA,UAAUA,CAAAA;IACtCA,CAACA;IAEDD,6BAAUA,GAAVA;QACEE,MAAMA,CAACA,CAACA,CAACA,CAACA,IAAIA,CAACA,MAAMA,GAAGA,GAAGA,CAACA,CAAAA;IAC9BA,CAACA;IAEDF,wBAAKA,GAALA,UAAOA,OAAeA,EAAEA,IAAYA,EAAEA,KAAaA;QACjDG,MAAMA,CAACA,IAAIA,CAACA,OAAOA,CAACA,KAAKA,CAACA,OAAOA,EAAEA,IAAIA,EAAEA,KAAKA,CAACA,CAAAA;IACjDA,CAACA;IAEDH,yBAAMA,GAANA;QACEI,MAAMA,CAACA;YACLA,GAAGA,EAAEA,IAAIA,CAACA,GAAGA;YACbA,OAAOA,EAAEA,IAAIA,CAACA,OAAOA;YACrBA,UAAUA,EAAEA,IAAIA,CAACA,UAAUA;YAC3BA,IAAIA,EAAEA,IAAIA,CAACA,IAAIA;YACfA,MAAMA,EAAEA,IAAIA,CAACA,MAAMA;YACnBA,UAAUA,EAAEA,IAAIA,CAACA,UAAUA;SAC5BA,CAAAA;IACHA,CAACA;IAEHJ,eAACA;AAADA,CAACA,AAjCD,EAAsC,cAAI,EAiCzC;AAjCD;0BAiCC,CAAA"}
|
0
node_modules/popsicle/dist/test/index.d.ts
generated
vendored
Normal file
0
node_modules/popsicle/dist/test/index.d.ts
generated
vendored
Normal file
913
node_modules/popsicle/dist/test/index.js
generated
vendored
Normal file
913
node_modules/popsicle/dist/test/index.js
generated
vendored
Normal file
@ -0,0 +1,913 @@
|
||||
var test = require('blue-tape');
|
||||
var methods = require('methods');
|
||||
var FormData = require('form-data');
|
||||
var Promise = require('any-promise');
|
||||
var fs_1 = require('fs');
|
||||
var path_1 = require('path');
|
||||
var popsicle = require('../common');
|
||||
var SHORTHAND_METHODS = [
|
||||
'get',
|
||||
'post',
|
||||
'put',
|
||||
'patch',
|
||||
'del'
|
||||
];
|
||||
var SUPPORTED_METHODS = typeof window === 'object' ? [
|
||||
'get',
|
||||
'post',
|
||||
'put',
|
||||
'patch',
|
||||
'delete'
|
||||
] : methods.filter(function (method) { return method !== 'connect'; });
|
||||
var METHODS_WITHOUT_BODY = ['connect', 'head', 'options'];
|
||||
var REMOTE_URL = 'http://localhost:' + process.env.PORT;
|
||||
var REMOTE_HTTPS_URL = 'https://localhost:' + process.env.HTTPS_PORT;
|
||||
var EXAMPLE_BODY = {
|
||||
username: 'blakeembrey',
|
||||
password: 'hunter2'
|
||||
};
|
||||
var BOUNDARY_REGEXP = /^multipart\/form-data; boundary=([^;]+)/;
|
||||
var supportsStatusText = parseFloat(process.version.replace(/^v/, '')) >= 0.12;
|
||||
test('should expose default functions', function (t) {
|
||||
t.equal(typeof popsicle, 'object');
|
||||
t.equal(typeof popsicle.Request, 'function');
|
||||
t.equal(typeof popsicle.Response, 'function');
|
||||
t.equal(typeof popsicle.form, 'function');
|
||||
t.equal(typeof popsicle.jar, 'function');
|
||||
SHORTHAND_METHODS.forEach(function (method) {
|
||||
t.equal(typeof popsicle[method], 'function');
|
||||
});
|
||||
t.end();
|
||||
});
|
||||
test('throw an error when no options are provided', function (t) {
|
||||
t.throws(function () { return popsicle.request({}); }, /url must be a string/i);
|
||||
t.end();
|
||||
});
|
||||
test('create a popsicle#Request instance', function (t) {
|
||||
var req = popsicle.request('/');
|
||||
t.ok(req instanceof popsicle.Request);
|
||||
return req.then(null, function () { });
|
||||
});
|
||||
test('use the same response in promise chains', function (t) {
|
||||
var req = popsicle.get(REMOTE_URL + '/echo');
|
||||
t.plan(15);
|
||||
return req
|
||||
.then(function (res) {
|
||||
t.ok(res instanceof popsicle.Response);
|
||||
t.ok(typeof res.url === 'string' || res.url == null);
|
||||
t.ok(Array.isArray(res.rawHeaders));
|
||||
t.equal(typeof res.headers, 'object');
|
||||
t.equal(typeof res.status, 'number');
|
||||
t.equal(typeof res.get, 'function');
|
||||
t.equal(typeof res.name, 'function');
|
||||
t.equal(typeof res.type, 'function');
|
||||
t.equal(typeof res.statusType, 'function');
|
||||
t.equal(typeof res.error, 'function');
|
||||
t.equal(typeof res.toJSON, 'function');
|
||||
t.equal(res.request, req);
|
||||
t.deepEqual(Object.keys(req.toJSON()), ['url', 'headers', 'body', 'options', 'timeout', 'method']);
|
||||
t.deepEqual(Object.keys(res.toJSON()), ['url', 'headers', 'rawHeaders', 'body', 'status', 'statusText']);
|
||||
return req
|
||||
.then(function (res2) {
|
||||
t.equal(res, res2);
|
||||
});
|
||||
});
|
||||
});
|
||||
test('clone a request instance', function (t) {
|
||||
var req = popsicle.get(REMOTE_URL + '/echo/header/x-example');
|
||||
req.use(function (self) {
|
||||
self.before(function (req) {
|
||||
req.set('X-Example', 'foobar');
|
||||
});
|
||||
});
|
||||
return Promise.all([req, req.clone()])
|
||||
.then(function (res) {
|
||||
t.notEqual(res[0], res[1]);
|
||||
t.equal(res[0].body, 'foobar');
|
||||
t.equal(res[0].body, res[1].body);
|
||||
});
|
||||
});
|
||||
test('methods', function (t) {
|
||||
t.test('use node-style callbacks', function (t) {
|
||||
t.plan(1);
|
||||
return popsicle.request(REMOTE_URL + '/echo')
|
||||
.exec(function (err, res) {
|
||||
t.ok(res instanceof popsicle.Response);
|
||||
t.end();
|
||||
});
|
||||
});
|
||||
t.test('allow methods to be passed in', function (t) {
|
||||
return Promise.all(SUPPORTED_METHODS.map(function (method) {
|
||||
return popsicle.request({
|
||||
url: REMOTE_URL + '/echo/method',
|
||||
method: method
|
||||
})
|
||||
.then(function (res) {
|
||||
t.equal(res.status, 200);
|
||||
t.equal(res.body, METHODS_WITHOUT_BODY.indexOf(method) === -1 ? method.toUpperCase() : null);
|
||||
});
|
||||
}));
|
||||
});
|
||||
});
|
||||
test('allow usage of method shorthands', function (t) {
|
||||
return Promise.all(SHORTHAND_METHODS.map(function (method) {
|
||||
return popsicle[method](REMOTE_URL + '/echo/method')
|
||||
.then(function (res) {
|
||||
t.equal(res.status, 200);
|
||||
t.equal(res.body, method === 'del' ? 'DELETE' : method.toUpperCase());
|
||||
});
|
||||
}));
|
||||
});
|
||||
test('response status', function (t) {
|
||||
t.test('5xx', function (t) {
|
||||
return popsicle.request(REMOTE_URL + '/error')
|
||||
.then(function (res) {
|
||||
t.equal(res.status, 500);
|
||||
t.equal(res.statusType(), 5);
|
||||
if (supportsStatusText) {
|
||||
t.equal(res.statusText, 'Internal Server Error');
|
||||
}
|
||||
});
|
||||
});
|
||||
t.test('4xx', function (t) {
|
||||
return popsicle.request(REMOTE_URL + '/not-found')
|
||||
.then(function (res) {
|
||||
t.equal(res.status, 404);
|
||||
t.equal(res.statusType(), 4);
|
||||
if (supportsStatusText) {
|
||||
t.equal(res.statusText, 'Not Found');
|
||||
}
|
||||
});
|
||||
});
|
||||
t.test('2xx', function (t) {
|
||||
return popsicle.request(REMOTE_URL + '/no-content')
|
||||
.then(function (res) {
|
||||
t.equal(res.status, 204);
|
||||
t.equal(res.statusType(), 2);
|
||||
if (supportsStatusText) {
|
||||
t.equal(res.statusText, 'No Content');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
test('request headers', function (t) {
|
||||
t.test('always send user agent', function (t) {
|
||||
return popsicle.request(REMOTE_URL + '/echo/header/user-agent')
|
||||
.then(function (res) {
|
||||
var regexp = process.browser ?
|
||||
/^Mozilla\/.+$/ :
|
||||
/^https:\/\/github\.com\/blakeembrey\/popsicle$/;
|
||||
t.ok(regexp.test(res.body));
|
||||
});
|
||||
});
|
||||
if (!popsicle.browser) {
|
||||
t.test('send a custom user agent header', function (t) {
|
||||
return popsicle.request({
|
||||
url: REMOTE_URL + '/echo/header/user-agent',
|
||||
headers: {
|
||||
'User-Agent': 'foobar'
|
||||
}
|
||||
})
|
||||
.then(function (res) {
|
||||
t.equal(res.body, 'foobar');
|
||||
});
|
||||
});
|
||||
if (!/^v0\.10/.test(process.version)) {
|
||||
t.test('case sensitive headers', function (t) {
|
||||
return popsicle.get({
|
||||
url: REMOTE_URL + '/raw-headers',
|
||||
headers: {
|
||||
'Raw-Header': 'test'
|
||||
}
|
||||
})
|
||||
.then(function (res) {
|
||||
t.ok(res.body.indexOf('Raw-Header') > -1, 'raw headers sent with original casing');
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
test('response headers', function (t) {
|
||||
t.test('parse', function (t) {
|
||||
return popsicle.request(REMOTE_URL + '/notfound')
|
||||
.then(function (res) {
|
||||
t.equal(res.type(), 'text/html');
|
||||
t.equal(res.get('Content-Type'), 'text/html; charset=utf-8');
|
||||
});
|
||||
});
|
||||
});
|
||||
test('request body', function (t) {
|
||||
t.test('send post data', function (t) {
|
||||
return popsicle.request({
|
||||
url: REMOTE_URL + '/echo',
|
||||
method: 'POST',
|
||||
body: 'example data',
|
||||
headers: {
|
||||
'content-type': 'application/octet-stream'
|
||||
}
|
||||
})
|
||||
.then(function (res) {
|
||||
t.equal(res.body, 'example data');
|
||||
t.equal(res.status, 200);
|
||||
t.equal(res.type(), 'application/octet-stream');
|
||||
if (supportsStatusText) {
|
||||
t.equal(res.statusText, 'OK');
|
||||
}
|
||||
});
|
||||
});
|
||||
t.test('should automatically send objects as json', function (t) {
|
||||
return popsicle.request({
|
||||
url: REMOTE_URL + '/echo',
|
||||
method: 'POST',
|
||||
body: EXAMPLE_BODY
|
||||
})
|
||||
.then(function (res) {
|
||||
t.deepEqual(res.body, EXAMPLE_BODY);
|
||||
t.equal(res.type(), 'application/json');
|
||||
});
|
||||
});
|
||||
t.test('should send as form encoded when header is set', function (t) {
|
||||
return popsicle.request({
|
||||
url: REMOTE_URL + '/echo',
|
||||
method: 'POST',
|
||||
body: EXAMPLE_BODY,
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
}
|
||||
})
|
||||
.then(function (res) {
|
||||
t.deepEqual(res.body, EXAMPLE_BODY);
|
||||
t.equal(res.type(), 'application/x-www-form-urlencoded');
|
||||
});
|
||||
});
|
||||
t.test('host objects', function (t) {
|
||||
t.test('form data', function (t) {
|
||||
function validateResponse(res) {
|
||||
var boundary = BOUNDARY_REGEXP.exec(res.headers['content-type'])[1];
|
||||
var body = [
|
||||
'--' + boundary,
|
||||
'Content-Disposition: form-data; name="username"',
|
||||
'',
|
||||
EXAMPLE_BODY.username,
|
||||
'--' + boundary,
|
||||
'Content-Disposition: form-data; name="password"',
|
||||
'',
|
||||
EXAMPLE_BODY.password,
|
||||
'--' + boundary + '--'
|
||||
].join('\r\n');
|
||||
if (typeof window !== 'undefined') {
|
||||
body += '\r\n';
|
||||
}
|
||||
t.equal(res.body, body);
|
||||
}
|
||||
t.test('should create form data instance', function (t) {
|
||||
var form = popsicle.form(EXAMPLE_BODY);
|
||||
t.ok(form instanceof FormData);
|
||||
return popsicle.request({
|
||||
url: REMOTE_URL + '/echo',
|
||||
method: 'POST',
|
||||
body: form
|
||||
}).then(validateResponse);
|
||||
});
|
||||
t.test('should stringify to form data when set as multipart', function (t) {
|
||||
return popsicle.request({
|
||||
url: REMOTE_URL + '/echo',
|
||||
method: 'POST',
|
||||
body: EXAMPLE_BODY,
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data'
|
||||
}
|
||||
}).then(validateResponse);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
test('query', function (t) {
|
||||
t.test('should stringify and send query parameters', function (t) {
|
||||
return popsicle.request({
|
||||
url: REMOTE_URL + '/echo/query',
|
||||
query: EXAMPLE_BODY
|
||||
})
|
||||
.then(function (res) {
|
||||
t.deepEqual(res.body, EXAMPLE_BODY);
|
||||
});
|
||||
});
|
||||
t.test('should stringify and append to query object', function (t) {
|
||||
var req = popsicle.request({
|
||||
url: REMOTE_URL + '/echo/query?query=true',
|
||||
query: EXAMPLE_BODY
|
||||
});
|
||||
var query = {
|
||||
query: 'true',
|
||||
username: 'blakeembrey',
|
||||
password: 'hunter2'
|
||||
};
|
||||
var fullUrl = REMOTE_URL + '/echo/query?query=true&username=blakeembrey&password=hunter2';
|
||||
t.equal(req.url, fullUrl);
|
||||
t.deepEqual(req.query, query);
|
||||
return req
|
||||
.then(function (res) {
|
||||
if (typeof window === 'undefined') {
|
||||
t.equal(res.url, fullUrl);
|
||||
}
|
||||
t.deepEqual(res.body, query);
|
||||
});
|
||||
});
|
||||
t.test('should accept query as a string', function (t) {
|
||||
var req = popsicle.request({
|
||||
url: REMOTE_URL + '/echo/query',
|
||||
query: 'query=true'
|
||||
});
|
||||
t.equal(req.url, REMOTE_URL + '/echo/query?query=true');
|
||||
t.deepEqual(req.query, { query: 'true' });
|
||||
return req
|
||||
.then(function (res) {
|
||||
t.deepEqual(res.body, { query: 'true' });
|
||||
});
|
||||
});
|
||||
});
|
||||
test('timeout', function (t) {
|
||||
t.test('should timeout the request when set', function (t) {
|
||||
t.plan(3);
|
||||
return popsicle.request({
|
||||
url: REMOTE_URL + '/delay/1500',
|
||||
timeout: 500
|
||||
})
|
||||
.catch(function (err) {
|
||||
t.equal(err.message, 'Timeout of 500ms exceeded');
|
||||
t.equal(err.code, 'ETIMEOUT');
|
||||
t.ok(err.popsicle instanceof popsicle.Request);
|
||||
});
|
||||
});
|
||||
});
|
||||
test('abort', function (t) {
|
||||
t.test('abort before it starts', function (t) {
|
||||
var req = popsicle.request(REMOTE_URL + '/echo');
|
||||
req.abort();
|
||||
t.plan(3);
|
||||
return req
|
||||
.catch(function (err) {
|
||||
t.equal(err.message, 'Request aborted');
|
||||
t.equal(err.code, 'EABORT');
|
||||
t.ok(err.popsicle instanceof popsicle.Request);
|
||||
});
|
||||
});
|
||||
t.test('abort mid-request', function (t) {
|
||||
var req = popsicle.request(REMOTE_URL + '/download');
|
||||
t.plan(3);
|
||||
setTimeout(function () {
|
||||
req.abort();
|
||||
}, 100);
|
||||
return req
|
||||
.catch(function (err) {
|
||||
t.equal(err.message, 'Request aborted');
|
||||
t.equal(err.code, 'EABORT');
|
||||
t.ok(err.popsicle instanceof popsicle.Request);
|
||||
});
|
||||
});
|
||||
t.test('no side effects of aborting twice', function (t) {
|
||||
var req = popsicle.request(REMOTE_URL + '/download');
|
||||
t.plan(3);
|
||||
req.abort();
|
||||
req.abort();
|
||||
return req
|
||||
.catch(function (err) {
|
||||
t.equal(err.message, 'Request aborted');
|
||||
t.equal(err.code, 'EABORT');
|
||||
t.ok(err.popsicle instanceof popsicle.Request);
|
||||
});
|
||||
});
|
||||
});
|
||||
test('progress', function (t) {
|
||||
t.test('download', function (t) {
|
||||
t.test('download progress', function (t) {
|
||||
var req = popsicle.request(REMOTE_URL + '/download');
|
||||
t.plan(typeof window === 'undefined' ? 3 : 2);
|
||||
t.equal(req.downloaded, 0);
|
||||
if (typeof window === 'undefined') {
|
||||
setTimeout(function () {
|
||||
t.equal(req.downloaded, 0.5);
|
||||
}, 100);
|
||||
}
|
||||
return req
|
||||
.then(function () {
|
||||
t.equal(req.downloaded, 1);
|
||||
});
|
||||
});
|
||||
});
|
||||
t.test('event', function (t) {
|
||||
t.test('emit progress events', function (t) {
|
||||
var req = popsicle.request({
|
||||
url: REMOTE_URL + '/echo',
|
||||
body: EXAMPLE_BODY,
|
||||
method: 'POST'
|
||||
});
|
||||
t.plan(3);
|
||||
var asserted = 0;
|
||||
var expected = 0;
|
||||
req.progress(function (e) {
|
||||
expected += 0.5;
|
||||
t.equal(e.completed, expected);
|
||||
});
|
||||
return req
|
||||
.then(function (res) {
|
||||
t.deepEqual(res.body, EXAMPLE_BODY);
|
||||
});
|
||||
});
|
||||
t.test('error when the progress callback errors', function (t) {
|
||||
var req = popsicle.request(REMOTE_URL + '/echo');
|
||||
t.plan(2);
|
||||
req.progress(function () {
|
||||
throw new Error('Testing');
|
||||
});
|
||||
return req
|
||||
.catch(function (err) {
|
||||
t.equal(err.message, 'Testing');
|
||||
t.notOk(err.popsicle, 'popsicle should not be set');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
test('response body', function (t) {
|
||||
t.test('automatically parse json responses', function (t) {
|
||||
return popsicle.request(REMOTE_URL + '/json')
|
||||
.then(function (res) {
|
||||
t.equal(res.type(), 'application/json');
|
||||
t.deepEqual(res.body, { username: 'blakeembrey' });
|
||||
});
|
||||
});
|
||||
t.test('automatically parse form encoded responses', function (t) {
|
||||
return popsicle.request(REMOTE_URL + '/foo')
|
||||
.then(function (res) {
|
||||
t.equal(res.type(), 'application/x-www-form-urlencoded');
|
||||
t.deepEqual(res.body, { foo: 'bar' });
|
||||
});
|
||||
});
|
||||
t.test('disable automatic parsing', function (t) {
|
||||
return popsicle.request({
|
||||
url: REMOTE_URL + '/json',
|
||||
use: popsicle.browser ? [] : [popsicle.plugins.concatStream('string')]
|
||||
})
|
||||
.then(function (res) {
|
||||
t.equal(res.type(), 'application/json');
|
||||
t.equal(res.body, '{"username":"blakeembrey"}');
|
||||
});
|
||||
});
|
||||
t.test('set non-parsable responses as null', function (t) {
|
||||
return popsicle.request({
|
||||
url: REMOTE_URL + '/echo',
|
||||
method: 'post'
|
||||
})
|
||||
.then(function (res) {
|
||||
t.equal(res.body, null);
|
||||
});
|
||||
});
|
||||
t.test('set body to null when json is empty', function (t) {
|
||||
return popsicle.request({
|
||||
url: REMOTE_URL + '/echo',
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
})
|
||||
.then(function (res) {
|
||||
t.equal(res.body, null);
|
||||
t.equal(res.type(), 'application/json');
|
||||
});
|
||||
});
|
||||
if (!process.browser) {
|
||||
var fs = require('fs');
|
||||
var concat = require('concat-stream');
|
||||
var filename = require('path').join(__dirname, '../../scripts/server.js');
|
||||
var filecontents = fs.readFileSync(filename, 'utf-8');
|
||||
t.test('stream the response body', function (t) {
|
||||
return popsicle.request({
|
||||
url: REMOTE_URL + '/json',
|
||||
use: []
|
||||
})
|
||||
.then(function (res) {
|
||||
t.equal(typeof res.body, 'object');
|
||||
return new Promise(function (resolve) {
|
||||
res.body.pipe(concat(function (data) {
|
||||
t.equal(data.toString(), '{"username":"blakeembrey"}');
|
||||
return resolve();
|
||||
}));
|
||||
});
|
||||
});
|
||||
});
|
||||
t.test('pipe streams', function (t) {
|
||||
return popsicle.request({
|
||||
url: REMOTE_URL + '/echo',
|
||||
body: fs.createReadStream(filename)
|
||||
})
|
||||
.then(function (res) {
|
||||
t.equal(res.body, filecontents);
|
||||
});
|
||||
});
|
||||
t.test('pipe streams into forms', function (t) {
|
||||
return popsicle.request({
|
||||
url: REMOTE_URL + '/echo',
|
||||
body: popsicle.form({
|
||||
file: fs.createReadStream(filename)
|
||||
})
|
||||
})
|
||||
.then(function (res) {
|
||||
var boundary = BOUNDARY_REGEXP.exec(res.headers['content-type'])[1];
|
||||
t.equal(res.body, [
|
||||
'--' + boundary,
|
||||
'Content-Disposition: form-data; name="file"; filename="server.js"',
|
||||
'Content-Type: application/javascript',
|
||||
'',
|
||||
filecontents,
|
||||
'--' + boundary + '--'
|
||||
].join('\r\n'));
|
||||
});
|
||||
});
|
||||
t.test('unzip contents', function (t) {
|
||||
return popsicle.request({
|
||||
url: REMOTE_URL + '/echo/zip',
|
||||
body: fs.createReadStream(filename)
|
||||
})
|
||||
.then(function (res) {
|
||||
t.equal(res.get('Content-Encoding'), 'deflate');
|
||||
t.equal(res.body, filecontents);
|
||||
});
|
||||
});
|
||||
t.test('unzip with gzip encoding', function (t) {
|
||||
return popsicle.request({
|
||||
url: REMOTE_URL + '/echo/zip',
|
||||
body: fs.createReadStream(filename),
|
||||
headers: {
|
||||
'Accept-Encoding': 'gzip'
|
||||
}
|
||||
})
|
||||
.then(function (res) {
|
||||
t.equal(res.get('Content-Encoding'), 'gzip');
|
||||
t.equal(res.body, filecontents);
|
||||
});
|
||||
});
|
||||
}
|
||||
else {
|
||||
t.test('browser response type', function (t) {
|
||||
return popsicle.request({
|
||||
url: REMOTE_URL + '/text',
|
||||
options: {
|
||||
responseType: 'arraybuffer'
|
||||
}
|
||||
})
|
||||
.then(function (res) {
|
||||
t.ok(res.body instanceof ArrayBuffer);
|
||||
});
|
||||
});
|
||||
t.test('throw on unsupported response type', function (t) {
|
||||
t.plan(2);
|
||||
return popsicle.request({
|
||||
url: REMOTE_URL + '/text',
|
||||
options: {
|
||||
responseType: 'foobar'
|
||||
}
|
||||
})
|
||||
.catch(function (err) {
|
||||
t.equal(err.message, 'Unsupported response type: foobar');
|
||||
t.equal(err.code, 'ERESPONSETYPE');
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
test('request errors', function (t) {
|
||||
t.test('error when requesting an unknown domain', function (t) {
|
||||
t.plan(3);
|
||||
return popsicle.request('http://fdahkfjhuehfakjbvdahjfds.fdsa')
|
||||
.catch(function (err) {
|
||||
t.ok(/Unable to connect/i.exec(err.message));
|
||||
t.equal(err.code, 'EUNAVAILABLE');
|
||||
t.ok(err.popsicle instanceof popsicle.Request);
|
||||
});
|
||||
});
|
||||
t.test('give a parse error on invalid response body', function (t) {
|
||||
t.plan(3);
|
||||
return popsicle.request({
|
||||
url: REMOTE_URL + '/echo',
|
||||
method: 'POST',
|
||||
body: 'username=blakeembrey&password=hunter2',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
})
|
||||
.catch(function (err) {
|
||||
t.ok(/Unable to parse response body/i.test(err.message));
|
||||
t.equal(err.code, 'EPARSE');
|
||||
t.ok(err.popsicle instanceof popsicle.Request);
|
||||
});
|
||||
});
|
||||
t.test('give a stringify error on invalid request body', function (t) {
|
||||
var obj = {};
|
||||
t.plan(3);
|
||||
obj.obj = obj;
|
||||
return popsicle.request({
|
||||
url: REMOTE_URL + '/echo',
|
||||
method: 'POST',
|
||||
body: obj
|
||||
})
|
||||
.catch(function (err) {
|
||||
t.ok(/Unable to stringify request body/i.test(err.message));
|
||||
t.equal(err.code, 'ESTRINGIFY');
|
||||
t.ok(err.popsicle instanceof popsicle.Request);
|
||||
});
|
||||
});
|
||||
});
|
||||
test('plugins', function (t) {
|
||||
t.test('modify the request', function (t) {
|
||||
var req = popsicle.request(REMOTE_URL + '/echo');
|
||||
t.plan(1);
|
||||
req.use(function (self) {
|
||||
t.equal(self, req);
|
||||
});
|
||||
return req;
|
||||
});
|
||||
});
|
||||
test('request flow', function (t) {
|
||||
t.test('before', function (t) {
|
||||
t.test('run a function before opening the request', function (t) {
|
||||
var req = popsicle.request(REMOTE_URL + '/echo');
|
||||
t.plan(2);
|
||||
req.before(function (self) {
|
||||
t.equal(self, req);
|
||||
t.notOk(req.response);
|
||||
});
|
||||
return req;
|
||||
});
|
||||
t.test('fail the request before starting', function (t) {
|
||||
var req = popsicle.request(REMOTE_URL + '/echo');
|
||||
t.plan(1);
|
||||
req.before(function () {
|
||||
throw new Error('Hello world!');
|
||||
});
|
||||
return req
|
||||
.catch(function (err) {
|
||||
t.equal(err.message, 'Hello world!');
|
||||
});
|
||||
});
|
||||
t.test('accept a promise to delay the request', function (t) {
|
||||
var req = popsicle.request(REMOTE_URL + '/echo');
|
||||
t.plan(1);
|
||||
req.before(function (self) {
|
||||
return new Promise(function (resolve) {
|
||||
setTimeout(function () {
|
||||
t.equal(self, req);
|
||||
resolve();
|
||||
}, 10);
|
||||
});
|
||||
});
|
||||
return req;
|
||||
});
|
||||
});
|
||||
test('after', function (t) {
|
||||
t.test('run after the response', function (t) {
|
||||
var req = popsicle.request(REMOTE_URL + '/echo');
|
||||
t.plan(4);
|
||||
req.before(function () {
|
||||
t.notOk(req.response);
|
||||
});
|
||||
req.after(function (response) {
|
||||
t.ok(response instanceof popsicle.Response);
|
||||
t.equal(req.response, response);
|
||||
t.equal(response.request, req);
|
||||
});
|
||||
return req;
|
||||
});
|
||||
t.test('accept a promise', function (t) {
|
||||
var req = popsicle.request(REMOTE_URL + '/echo');
|
||||
t.plan(1);
|
||||
req.after(function (response) {
|
||||
return new Promise(function (resolve) {
|
||||
setTimeout(function () {
|
||||
t.equal(response, req.response);
|
||||
resolve();
|
||||
}, 10);
|
||||
});
|
||||
});
|
||||
return req;
|
||||
});
|
||||
});
|
||||
test('always', function (t) {
|
||||
t.test('run all together in order', function (t) {
|
||||
var req = popsicle.request(REMOTE_URL + '/echo');
|
||||
var before = false;
|
||||
var after = false;
|
||||
var always = false;
|
||||
t.plan(6);
|
||||
req.before(function () {
|
||||
before = true;
|
||||
t.notOk(after);
|
||||
t.notOk(always);
|
||||
});
|
||||
req.after(function () {
|
||||
after = true;
|
||||
t.ok(before);
|
||||
t.notOk(always);
|
||||
});
|
||||
req.always(function (request) {
|
||||
always = true;
|
||||
t.ok(before);
|
||||
t.ok(after);
|
||||
});
|
||||
return req;
|
||||
});
|
||||
t.test('run on error', function (t) {
|
||||
var req = popsicle.request(REMOTE_URL + '/echo');
|
||||
t.plan(2);
|
||||
req.before(function () {
|
||||
throw new Error('Testing');
|
||||
});
|
||||
req.always(function (self) {
|
||||
t.equal(self, req);
|
||||
});
|
||||
return req
|
||||
.catch(function (err) {
|
||||
t.equal(err.message, 'Testing');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
if (!process.browser) {
|
||||
test('cookie jar', function (t) {
|
||||
t.test('should work with a cookie jar', function (t) {
|
||||
var cookie;
|
||||
var instance = popsicle.defaults({
|
||||
options: {
|
||||
jar: popsicle.jar()
|
||||
}
|
||||
});
|
||||
return instance(REMOTE_URL + '/cookie')
|
||||
.then(function (res) {
|
||||
t.notOk(res.get('Cookie'));
|
||||
t.ok(res.get('Set-Cookie'));
|
||||
cookie = res.get('Set-Cookie');
|
||||
return instance(REMOTE_URL + '/echo');
|
||||
})
|
||||
.then(function (res) {
|
||||
t.equal(res.get('Cookie').toLowerCase(), cookie.toLowerCase());
|
||||
t.notOk(res.get('Set-Cookie'));
|
||||
});
|
||||
});
|
||||
t.test('should update over redirects', function (t) {
|
||||
var instance = popsicle.defaults({
|
||||
options: {
|
||||
jar: popsicle.jar()
|
||||
}
|
||||
});
|
||||
return instance(REMOTE_URL + '/cookie/redirect')
|
||||
.then(function (res) {
|
||||
t.ok(/^new=cookie/.test(res.body));
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
test('override request mechanism', function (t) {
|
||||
return popsicle.request({
|
||||
url: '/foo',
|
||||
transport: {
|
||||
open: function (request) {
|
||||
return Promise.resolve({
|
||||
url: '/foo',
|
||||
body: 'testing',
|
||||
headers: {},
|
||||
status: 200,
|
||||
statusText: 'OK'
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
.then(function (res) {
|
||||
t.equal(res.body, 'testing');
|
||||
});
|
||||
});
|
||||
if (!popsicle.browser) {
|
||||
test('redirect', function (t) {
|
||||
t.test('should follow 302 redirect with get', function (t) {
|
||||
return popsicle.request(REMOTE_URL + '/redirect')
|
||||
.then(function (res) {
|
||||
t.equal(res.body, 'welcome get');
|
||||
t.equal(res.status, 200);
|
||||
t.ok(/\/destination$/.test(res.url));
|
||||
});
|
||||
});
|
||||
t.test('should follow 301 redirect with post', function (t) {
|
||||
return popsicle.post(REMOTE_URL + '/redirect/code/301')
|
||||
.then(function (res) {
|
||||
t.equal(res.body, 'welcome get');
|
||||
t.equal(res.status, 200);
|
||||
t.ok(/\/destination$/.test(res.url));
|
||||
});
|
||||
});
|
||||
t.test('should follow 303 redirect with post', function (t) {
|
||||
return popsicle.post({
|
||||
url: REMOTE_URL + '/redirect/code/303',
|
||||
body: { foo: 'bar' }
|
||||
})
|
||||
.then(function (res) {
|
||||
t.equal(res.body, 'welcome get');
|
||||
t.equal(res.status, 200);
|
||||
t.ok(/\/destination$/.test(res.url));
|
||||
});
|
||||
});
|
||||
t.test('disable following redirects', function (t) {
|
||||
return popsicle.request({
|
||||
url: REMOTE_URL + '/redirect',
|
||||
options: {
|
||||
followRedirects: false
|
||||
}
|
||||
})
|
||||
.then(function (res) {
|
||||
t.equal(res.status, 302);
|
||||
t.ok(/\/redirect$/.test(res.url));
|
||||
});
|
||||
});
|
||||
t.test('default maximum redirects of 5', function (t) {
|
||||
t.plan(2);
|
||||
return popsicle.request(REMOTE_URL + '/redirect/6')
|
||||
.catch(function (err) {
|
||||
t.equal(err.message, 'Exceeded maximum of 5 redirects');
|
||||
t.equal(err.code, 'EMAXREDIRECTS');
|
||||
});
|
||||
});
|
||||
t.test('change maximum redirects', function (t) {
|
||||
return popsicle.request({
|
||||
url: REMOTE_URL + '/redirect/6',
|
||||
options: {
|
||||
maxRedirects: 10
|
||||
}
|
||||
})
|
||||
.then(function (res) {
|
||||
t.equal(res.body, 'welcome get');
|
||||
t.equal(res.status, 200);
|
||||
t.ok(/\/destination$/.test(res.url));
|
||||
});
|
||||
});
|
||||
t.test('support head redirects with 307', function (t) {
|
||||
return popsicle.head(REMOTE_URL + '/redirect/code/307')
|
||||
.then(function (res) {
|
||||
t.equal(res.body, null);
|
||||
t.equal(res.status, 200);
|
||||
t.ok(/\/destination$/.test(res.url));
|
||||
});
|
||||
});
|
||||
t.test('block 307/308 redirects by default', function (t) {
|
||||
return popsicle.post(REMOTE_URL + '/redirect/code/307')
|
||||
.then(function (res) {
|
||||
t.equal(res.status, 307);
|
||||
t.ok(/\/redirect\/code\/307$/.test(res.url));
|
||||
});
|
||||
});
|
||||
t.test('support user confirmed redirects with 308', function (t) {
|
||||
return popsicle.post({
|
||||
url: REMOTE_URL + '/redirect/code/308',
|
||||
options: {
|
||||
followRedirects: function () {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
})
|
||||
.then(function (res) {
|
||||
t.equal(res.body, 'welcome post');
|
||||
t.equal(res.status, 200);
|
||||
t.ok(/\/destination$/.test(res.url));
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
if (!popsicle.browser) {
|
||||
test('https reject unauthorized', function (t) {
|
||||
t.plan(1);
|
||||
return popsicle.get({
|
||||
url: "" + REMOTE_HTTPS_URL
|
||||
})
|
||||
.catch(function (err) {
|
||||
t.equal(err.code, 'EUNAVAILABLE');
|
||||
});
|
||||
});
|
||||
test('https ca option', function (t) {
|
||||
return popsicle.get({
|
||||
url: "" + REMOTE_HTTPS_URL,
|
||||
options: {
|
||||
ca: fs_1.readFileSync(path_1.join(__dirname, '../../scripts/support/ca-crt.pem'))
|
||||
}
|
||||
})
|
||||
.then(function (res) {
|
||||
t.equal(res.body, 'Success');
|
||||
});
|
||||
});
|
||||
test('https disable reject unauthorized', function (t) {
|
||||
return popsicle.get({
|
||||
url: "" + REMOTE_HTTPS_URL,
|
||||
options: {
|
||||
rejectUnauthorized: false
|
||||
}
|
||||
})
|
||||
.then(function (res) {
|
||||
t.equal(res.body, 'Success');
|
||||
});
|
||||
});
|
||||
}
|
||||
//# sourceMappingURL=index.js.map
|
1
node_modules/popsicle/dist/test/index.js.map
generated
vendored
Normal file
1
node_modules/popsicle/dist/test/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
51
node_modules/popsicle/logo.svg
generated
vendored
Normal file
51
node_modules/popsicle/logo.svg
generated
vendored
Normal file
@ -0,0 +1,51 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
width="736.463px" height="121.6px" viewBox="0 0 736.463 121.6" enable-background="new 0 0 736.463 121.6" xml:space="preserve">
|
||||
<g>
|
||||
<text transform="matrix(1 0 0 1 6.3281 97.1533)"><tspan x="0" y="0" fill="#22B573" font-family="'ArialRoundedMTBold'" font-size="100">P</tspan><tspan x="66.699" y="0" font-family="'ArialRoundedMTBold'" font-size="100"> </tspan><tspan x="91.699" y="0" fill="#22B573" font-family="'ArialRoundedMTBold'" font-size="100">O P</tspan><tspan x="262.598" y="0" font-family="'ArialRoundedMTBold'" font-size="100"> </tspan><tspan x="287.598" y="0" fill="#22B573" font-family="'ArialRoundedMTBold'" font-size="100">S</tspan><tspan x="354.297" y="0" fill="#8CC63F" font-family="'ArialRoundedMTBold'" font-size="100"> </tspan><tspan x="429.297" y="0" font-family="'ArialRoundedMTBold'" font-size="100"> </tspan><tspan x="454.297" y="0" font-family="'ArialRoundedMTBold'" font-size="100" letter-spacing="-11"> </tspan><tspan x="468" y="0" fill="#22B573" font-family="'ArialRoundedMTBold'" font-size="100">C</tspan><tspan x="542.023" y="0" font-family="'ArialRoundedMTBold'" font-size="100"> </tspan><tspan x="567.023" y="0" fill="#22B573" font-family="'ArialRoundedMTBold'" font-size="100">L E</tspan></text>
|
||||
<g>
|
||||
<g>
|
||||
<path fill="#93278F" d="M432.89,34.957c0-8.427-6.934-15.259-15.5-15.259s-15.5,6.832-15.5,15.259V36h31V34.957z"/>
|
||||
<g>
|
||||
<path fill="#93278F" d="M437.828,34.957c-0.508-11.813-9.9-20.702-21.812-20.203c-11.227,0.47-19.137,10.346-19.137,21.117
|
||||
c0,2.726,2.274,5,5,5c10.316,0,20.633,0,30.949,0c2.726,0,5-2.274,5-5C437.828,35.566,437.828,35.262,437.828,34.957
|
||||
c0-6.449-10-6.449-10,0c0,0.305,0,0.609,0,0.914c1.667-1.667,3.333-3.333,5-5c-10.316,0-20.633,0-30.949,0
|
||||
c1.667,1.667,3.333,3.333,5,5c0-13.779,20.353-14.793,20.949-0.914C428.104,41.38,438.105,41.407,437.828,34.957z"/>
|
||||
</g>
|
||||
</g>
|
||||
<path fill="#C69C6D" d="M419.89,109.716c0,1.526-1.273,2.764-3.5,2.764s-3.5-1.237-3.5-2.764V67h7V109.716z"/>
|
||||
<g>
|
||||
<rect x="401.89" y="63" fill="#93278F" width="31" height="12"/>
|
||||
<g>
|
||||
<path fill="#93278F" d="M401.879,79.744c10.316,0,20.633,0,30.949,0c2.726,0,5-2.274,5-5c0-4.01,0-8.02,0-12.03
|
||||
c0-2.726-2.274-5-5-5c-10.316,0-20.633,0-30.949,0c-2.726,0-5,2.274-5,5c0,4.01,0,8.02,0,12.03c0,6.449,10,6.449,10,0
|
||||
c0-4.01,0-8.02,0-12.03c-1.667,1.667-3.333,3.333-5,5c10.316,0,20.633,0,30.949,0c-1.667-1.667-3.333-3.333-5-5
|
||||
c0,4.01,0,8.02,0,12.03c1.667-1.667,3.333-3.333,5-5c-10.316,0-20.633,0-30.949,0C395.431,69.744,395.431,79.744,401.879,79.744
|
||||
z"/>
|
||||
</g>
|
||||
</g>
|
||||
<g>
|
||||
<rect x="401.89" y="50" fill="#93278F" width="31" height="13"/>
|
||||
<g>
|
||||
<path fill="#93278F" d="M396.879,49.767c0,4.316,0,8.631,0,12.947c0,2.726,2.274,5,5,5c10.316,0,20.633,0,30.949,0
|
||||
c2.726,0,5-2.274,5-5c0-4.316,0-8.631,0-12.947c0-2.726-2.274-5-5-5c-10.316,0-20.633,0-30.949,0c-6.448,0-6.448,10,0,10
|
||||
c10.316,0,20.633,0,30.949,0c-1.667-1.667-3.333-3.333-5-5c0,4.316,0,8.631,0,12.947c1.667-1.667,3.333-3.333,5-5
|
||||
c-10.316,0-20.633,0-30.949,0c1.667,1.667,3.333,3.333,5,5c0-4.316,0-8.631,0-12.947
|
||||
C406.879,43.318,396.879,43.318,396.879,49.767z"/>
|
||||
</g>
|
||||
</g>
|
||||
<g>
|
||||
<rect x="401.89" y="36" fill="#93278F" width="31" height="14"/>
|
||||
<g>
|
||||
<path fill="#93278F" d="M432.828,30.871c-10.316,0-20.633,0-30.949,0c-2.726,0-5,2.274-5,5c0,4.632,0,9.264,0,13.896
|
||||
c0,2.726,2.274,5,5,5c10.316,0,20.633,0,30.949,0c2.726,0,5-2.274,5-5c0-4.632,0-9.264,0-13.896c0-6.449-10-6.449-10,0
|
||||
c0,4.632,0,9.264,0,13.896c1.667-1.667,3.333-3.333,5-5c-10.316,0-20.633,0-30.949,0c1.667,1.667,3.333,3.333,5,5
|
||||
c0-4.632,0-9.264,0-13.896c-1.667,1.667-3.333,3.333-5,5c10.316,0,20.633,0,30.949,0
|
||||
C439.276,40.871,439.276,30.871,432.828,30.871z"/>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 4.0 KiB |
5
node_modules/popsicle/node_modules/async/.travis.yml
generated
vendored
Normal file
5
node_modules/popsicle/node_modules/async/.travis.yml
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "0.10"
|
||||
- "0.12"
|
||||
- "iojs"
|
19
node_modules/popsicle/node_modules/async/LICENSE
generated
vendored
Normal file
19
node_modules/popsicle/node_modules/async/LICENSE
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
Copyright (c) 2010-2014 Caolan McMahon
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
1647
node_modules/popsicle/node_modules/async/README.md
generated
vendored
Normal file
1647
node_modules/popsicle/node_modules/async/README.md
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
38
node_modules/popsicle/node_modules/async/bower.json
generated
vendored
Normal file
38
node_modules/popsicle/node_modules/async/bower.json
generated
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
{
|
||||
"name": "async",
|
||||
"description": "Higher-order functions and common patterns for asynchronous code",
|
||||
"version": "0.9.2",
|
||||
"main": "lib/async.js",
|
||||
"keywords": [
|
||||
"async",
|
||||
"callback",
|
||||
"utility",
|
||||
"module"
|
||||
],
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/caolan/async.git"
|
||||
},
|
||||
"devDependencies": {
|
||||
"nodeunit": ">0.0.0",
|
||||
"uglify-js": "1.2.x",
|
||||
"nodelint": ">0.0.0",
|
||||
"lodash": ">=2.4.1"
|
||||
},
|
||||
"moduleType": [
|
||||
"amd",
|
||||
"globals",
|
||||
"node"
|
||||
],
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"node_modules",
|
||||
"bower_components",
|
||||
"test",
|
||||
"tests"
|
||||
],
|
||||
"authors": [
|
||||
"Caolan McMahon"
|
||||
]
|
||||
}
|
16
node_modules/popsicle/node_modules/async/component.json
generated
vendored
Normal file
16
node_modules/popsicle/node_modules/async/component.json
generated
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"name": "async",
|
||||
"description": "Higher-order functions and common patterns for asynchronous code",
|
||||
"version": "0.9.2",
|
||||
"keywords": [
|
||||
"async",
|
||||
"callback",
|
||||
"utility",
|
||||
"module"
|
||||
],
|
||||
"license": "MIT",
|
||||
"repository": "caolan/async",
|
||||
"scripts": [
|
||||
"lib/async.js"
|
||||
]
|
||||
}
|
1123
node_modules/popsicle/node_modules/async/lib/async.js
generated
vendored
Normal file
1123
node_modules/popsicle/node_modules/async/lib/async.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
109
node_modules/popsicle/node_modules/async/package.json
generated
vendored
Normal file
109
node_modules/popsicle/node_modules/async/package.json
generated
vendored
Normal file
@ -0,0 +1,109 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"async@~0.9.0",
|
||||
"C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\popsicle\\node_modules\\form-data"
|
||||
]
|
||||
],
|
||||
"_from": "async@>=0.9.0-0 <0.10.0-0",
|
||||
"_id": "async@0.9.2",
|
||||
"_inCache": true,
|
||||
"_location": "/popsicle/async",
|
||||
"_nodeVersion": "2.0.1",
|
||||
"_npmUser": {
|
||||
"email": "beau@beaugunderson.com",
|
||||
"name": "beaugunderson"
|
||||
},
|
||||
"_npmVersion": "2.9.0",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "async",
|
||||
"raw": "async@~0.9.0",
|
||||
"rawSpec": "~0.9.0",
|
||||
"scope": null,
|
||||
"spec": ">=0.9.0-0 <0.10.0-0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/popsicle/form-data"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/async/-/async-0.9.2.tgz",
|
||||
"_shasum": "aea74d5e61c1f899613bf64bda66d4c78f2fd17d",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "async@~0.9.0",
|
||||
"_where": "C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\popsicle\\node_modules\\form-data",
|
||||
"author": {
|
||||
"name": "Caolan McMahon"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/caolan/async/issues"
|
||||
},
|
||||
"dependencies": {},
|
||||
"description": "Higher-order functions and common patterns for asynchronous code",
|
||||
"devDependencies": {
|
||||
"lodash": ">=2.4.1",
|
||||
"nodelint": ">0.0.0",
|
||||
"nodeunit": ">0.0.0",
|
||||
"uglify-js": "1.2.x"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "aea74d5e61c1f899613bf64bda66d4c78f2fd17d",
|
||||
"tarball": "https://registry.npmjs.org/async/-/async-0.9.2.tgz"
|
||||
},
|
||||
"gitHead": "de3a16091d5125384eff4a54deb3998b13c3814c",
|
||||
"homepage": "https://github.com/caolan/async#readme",
|
||||
"installable": true,
|
||||
"jam": {
|
||||
"categories": [
|
||||
"Utilities"
|
||||
],
|
||||
"include": [
|
||||
"LICENSE",
|
||||
"README.md",
|
||||
"lib/async.js"
|
||||
],
|
||||
"main": "lib/async.js"
|
||||
},
|
||||
"keywords": [
|
||||
"async",
|
||||
"callback",
|
||||
"module",
|
||||
"utility"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "lib/async.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "caolan",
|
||||
"email": "caolan.mcmahon@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "beaugunderson",
|
||||
"email": "beau@beaugunderson.com"
|
||||
}
|
||||
],
|
||||
"name": "async",
|
||||
"optionalDependencies": {},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/caolan/async.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "nodeunit test/test-async.js"
|
||||
},
|
||||
"spm": {
|
||||
"main": "lib/async.js"
|
||||
},
|
||||
"version": "0.9.2",
|
||||
"volo": {
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"bower_components",
|
||||
"node_modules",
|
||||
"test",
|
||||
"tests"
|
||||
],
|
||||
"main": "lib/async.js"
|
||||
}
|
||||
}
|
53
node_modules/popsicle/node_modules/async/support/sync-package-managers.js
generated
vendored
Normal file
53
node_modules/popsicle/node_modules/async/support/sync-package-managers.js
generated
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
// This should probably be its own module but complaints about bower/etc.
|
||||
// support keep coming up and I'd rather just enable the workflow here for now
|
||||
// and figure out where this should live later. -- @beaugunderson
|
||||
|
||||
var fs = require('fs');
|
||||
var _ = require('lodash');
|
||||
|
||||
var packageJson = require('../package.json');
|
||||
|
||||
var IGNORES = ['**/.*', 'node_modules', 'bower_components', 'test', 'tests'];
|
||||
var INCLUDES = ['lib/async.js', 'README.md', 'LICENSE'];
|
||||
var REPOSITORY_NAME = 'caolan/async';
|
||||
|
||||
packageJson.jam = {
|
||||
main: packageJson.main,
|
||||
include: INCLUDES,
|
||||
categories: ['Utilities']
|
||||
};
|
||||
|
||||
packageJson.spm = {
|
||||
main: packageJson.main
|
||||
};
|
||||
|
||||
packageJson.volo = {
|
||||
main: packageJson.main,
|
||||
ignore: IGNORES
|
||||
};
|
||||
|
||||
var bowerSpecific = {
|
||||
moduleType: ['amd', 'globals', 'node'],
|
||||
ignore: IGNORES,
|
||||
authors: [packageJson.author]
|
||||
};
|
||||
|
||||
var bowerInclude = ['name', 'description', 'version', 'main', 'keywords',
|
||||
'license', 'homepage', 'repository', 'devDependencies'];
|
||||
|
||||
var componentSpecific = {
|
||||
repository: REPOSITORY_NAME,
|
||||
scripts: [packageJson.main]
|
||||
};
|
||||
|
||||
var componentInclude = ['name', 'description', 'version', 'keywords',
|
||||
'license'];
|
||||
|
||||
var bowerJson = _.merge({}, _.pick(packageJson, bowerInclude), bowerSpecific);
|
||||
var componentJson = _.merge({}, _.pick(packageJson, componentInclude), componentSpecific);
|
||||
|
||||
fs.writeFileSync('./bower.json', JSON.stringify(bowerJson, null, 2));
|
||||
fs.writeFileSync('./component.json', JSON.stringify(componentJson, null, 2));
|
||||
fs.writeFileSync('./package.json', JSON.stringify(packageJson, null, 2));
|
19
node_modules/popsicle/node_modules/combined-stream/License
generated
vendored
Normal file
19
node_modules/popsicle/node_modules/combined-stream/License
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
Copyright (c) 2011 Debuggable Limited <felix@debuggable.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
132
node_modules/popsicle/node_modules/combined-stream/Readme.md
generated
vendored
Normal file
132
node_modules/popsicle/node_modules/combined-stream/Readme.md
generated
vendored
Normal file
@ -0,0 +1,132 @@
|
||||
# combined-stream [](https://travis-ci.org/felixge/node-combined-stream)
|
||||
|
||||
A stream that emits multiple other streams one after another.
|
||||
|
||||
## Installation
|
||||
|
||||
``` bash
|
||||
npm install combined-stream
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Here is a simple example that shows how you can use combined-stream to combine
|
||||
two files into one:
|
||||
|
||||
``` javascript
|
||||
var CombinedStream = require('combined-stream');
|
||||
var fs = require('fs');
|
||||
|
||||
var combinedStream = CombinedStream.create();
|
||||
combinedStream.append(fs.createReadStream('file1.txt'));
|
||||
combinedStream.append(fs.createReadStream('file2.txt'));
|
||||
|
||||
combinedStream.pipe(fs.createWriteStream('combined.txt'));
|
||||
```
|
||||
|
||||
While the example above works great, it will pause all source streams until
|
||||
they are needed. If you don't want that to happen, you can set `pauseStreams`
|
||||
to `false`:
|
||||
|
||||
``` javascript
|
||||
var CombinedStream = require('combined-stream');
|
||||
var fs = require('fs');
|
||||
|
||||
var combinedStream = CombinedStream.create({pauseStreams: false});
|
||||
combinedStream.append(fs.createReadStream('file1.txt'));
|
||||
combinedStream.append(fs.createReadStream('file2.txt'));
|
||||
|
||||
combinedStream.pipe(fs.createWriteStream('combined.txt'));
|
||||
```
|
||||
|
||||
However, what if you don't have all the source streams yet, or you don't want
|
||||
to allocate the resources (file descriptors, memory, etc.) for them right away?
|
||||
Well, in that case you can simply provide a callback that supplies the stream
|
||||
by calling a `next()` function:
|
||||
|
||||
``` javascript
|
||||
var CombinedStream = require('combined-stream');
|
||||
var fs = require('fs');
|
||||
|
||||
var combinedStream = CombinedStream.create();
|
||||
combinedStream.append(function(next) {
|
||||
next(fs.createReadStream('file1.txt'));
|
||||
});
|
||||
combinedStream.append(function(next) {
|
||||
next(fs.createReadStream('file2.txt'));
|
||||
});
|
||||
|
||||
combinedStream.pipe(fs.createWriteStream('combined.txt'));
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### CombinedStream.create([options])
|
||||
|
||||
Returns a new combined stream object. Available options are:
|
||||
|
||||
* `maxDataSize`
|
||||
* `pauseStreams`
|
||||
|
||||
The effect of those options is described below.
|
||||
|
||||
### combinedStream.pauseStreams = `true`
|
||||
|
||||
Whether to apply back pressure to the underlaying streams. If set to `false`,
|
||||
the underlaying streams will never be paused. If set to `true`, the
|
||||
underlaying streams will be paused right after being appended, as well as when
|
||||
`delayedStream.pipe()` wants to throttle.
|
||||
|
||||
### combinedStream.maxDataSize = `2 * 1024 * 1024`
|
||||
|
||||
The maximum amount of bytes (or characters) to buffer for all source streams.
|
||||
If this value is exceeded, `combinedStream` emits an `'error'` event.
|
||||
|
||||
### combinedStream.dataSize = `0`
|
||||
|
||||
The amount of bytes (or characters) currently buffered by `combinedStream`.
|
||||
|
||||
### combinedStream.append(stream)
|
||||
|
||||
Appends the given `stream` to the combinedStream object. If `pauseStreams` is
|
||||
set to `true, this stream will also be paused right away.
|
||||
|
||||
`streams` can also be a function that takes one parameter called `next`. `next`
|
||||
is a function that must be invoked in order to provide the `next` stream, see
|
||||
example above.
|
||||
|
||||
Regardless of how the `stream` is appended, combined-stream always attaches an
|
||||
`'error'` listener to it, so you don't have to do that manually.
|
||||
|
||||
Special case: `stream` can also be a String or Buffer.
|
||||
|
||||
### combinedStream.write(data)
|
||||
|
||||
You should not call this, `combinedStream` takes care of piping the appended
|
||||
streams into itself for you.
|
||||
|
||||
### combinedStream.resume()
|
||||
|
||||
Causes `combinedStream` to start drain the streams it manages. The function is
|
||||
idempotent, and also emits a `'resume'` event each time which usually goes to
|
||||
the stream that is currently being drained.
|
||||
|
||||
### combinedStream.pause();
|
||||
|
||||
If `combinedStream.pauseStreams` is set to `false`, this does nothing.
|
||||
Otherwise a `'pause'` event is emitted, this goes to the stream that is
|
||||
currently being drained, so you can use it to apply back pressure.
|
||||
|
||||
### combinedStream.end();
|
||||
|
||||
Sets `combinedStream.writable` to false, emits an `'end'` event, and removes
|
||||
all streams from the queue.
|
||||
|
||||
### combinedStream.destroy();
|
||||
|
||||
Same as `combinedStream.end()`, except it emits a `'close'` event instead of
|
||||
`'end'`.
|
||||
|
||||
## License
|
||||
|
||||
combined-stream is licensed under the MIT license.
|
188
node_modules/popsicle/node_modules/combined-stream/lib/combined_stream.js
generated
vendored
Normal file
188
node_modules/popsicle/node_modules/combined-stream/lib/combined_stream.js
generated
vendored
Normal file
@ -0,0 +1,188 @@
|
||||
var util = require('util');
|
||||
var Stream = require('stream').Stream;
|
||||
var DelayedStream = require('delayed-stream');
|
||||
|
||||
module.exports = CombinedStream;
|
||||
function CombinedStream() {
|
||||
this.writable = false;
|
||||
this.readable = true;
|
||||
this.dataSize = 0;
|
||||
this.maxDataSize = 2 * 1024 * 1024;
|
||||
this.pauseStreams = true;
|
||||
|
||||
this._released = false;
|
||||
this._streams = [];
|
||||
this._currentStream = null;
|
||||
}
|
||||
util.inherits(CombinedStream, Stream);
|
||||
|
||||
CombinedStream.create = function(options) {
|
||||
var combinedStream = new this();
|
||||
|
||||
options = options || {};
|
||||
for (var option in options) {
|
||||
combinedStream[option] = options[option];
|
||||
}
|
||||
|
||||
return combinedStream;
|
||||
};
|
||||
|
||||
CombinedStream.isStreamLike = function(stream) {
|
||||
return (typeof stream !== 'function')
|
||||
&& (typeof stream !== 'string')
|
||||
&& (typeof stream !== 'boolean')
|
||||
&& (typeof stream !== 'number')
|
||||
&& (!Buffer.isBuffer(stream));
|
||||
};
|
||||
|
||||
CombinedStream.prototype.append = function(stream) {
|
||||
var isStreamLike = CombinedStream.isStreamLike(stream);
|
||||
|
||||
if (isStreamLike) {
|
||||
if (!(stream instanceof DelayedStream)) {
|
||||
var newStream = DelayedStream.create(stream, {
|
||||
maxDataSize: Infinity,
|
||||
pauseStream: this.pauseStreams,
|
||||
});
|
||||
stream.on('data', this._checkDataSize.bind(this));
|
||||
stream = newStream;
|
||||
}
|
||||
|
||||
this._handleErrors(stream);
|
||||
|
||||
if (this.pauseStreams) {
|
||||
stream.pause();
|
||||
}
|
||||
}
|
||||
|
||||
this._streams.push(stream);
|
||||
return this;
|
||||
};
|
||||
|
||||
CombinedStream.prototype.pipe = function(dest, options) {
|
||||
Stream.prototype.pipe.call(this, dest, options);
|
||||
this.resume();
|
||||
return dest;
|
||||
};
|
||||
|
||||
CombinedStream.prototype._getNext = function() {
|
||||
this._currentStream = null;
|
||||
var stream = this._streams.shift();
|
||||
|
||||
|
||||
if (typeof stream == 'undefined') {
|
||||
this.end();
|
||||
return;
|
||||
}
|
||||
|
||||
if (typeof stream !== 'function') {
|
||||
this._pipeNext(stream);
|
||||
return;
|
||||
}
|
||||
|
||||
var getStream = stream;
|
||||
getStream(function(stream) {
|
||||
var isStreamLike = CombinedStream.isStreamLike(stream);
|
||||
if (isStreamLike) {
|
||||
stream.on('data', this._checkDataSize.bind(this));
|
||||
this._handleErrors(stream);
|
||||
}
|
||||
|
||||
this._pipeNext(stream);
|
||||
}.bind(this));
|
||||
};
|
||||
|
||||
CombinedStream.prototype._pipeNext = function(stream) {
|
||||
this._currentStream = stream;
|
||||
|
||||
var isStreamLike = CombinedStream.isStreamLike(stream);
|
||||
if (isStreamLike) {
|
||||
stream.on('end', this._getNext.bind(this));
|
||||
stream.pipe(this, {end: false});
|
||||
return;
|
||||
}
|
||||
|
||||
var value = stream;
|
||||
this.write(value);
|
||||
this._getNext();
|
||||
};
|
||||
|
||||
CombinedStream.prototype._handleErrors = function(stream) {
|
||||
var self = this;
|
||||
stream.on('error', function(err) {
|
||||
self._emitError(err);
|
||||
});
|
||||
};
|
||||
|
||||
CombinedStream.prototype.write = function(data) {
|
||||
this.emit('data', data);
|
||||
};
|
||||
|
||||
CombinedStream.prototype.pause = function() {
|
||||
if (!this.pauseStreams) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(this.pauseStreams && this._currentStream && typeof(this._currentStream.pause) == 'function') this._currentStream.pause();
|
||||
this.emit('pause');
|
||||
};
|
||||
|
||||
CombinedStream.prototype.resume = function() {
|
||||
if (!this._released) {
|
||||
this._released = true;
|
||||
this.writable = true;
|
||||
this._getNext();
|
||||
}
|
||||
|
||||
if(this.pauseStreams && this._currentStream && typeof(this._currentStream.resume) == 'function') this._currentStream.resume();
|
||||
this.emit('resume');
|
||||
};
|
||||
|
||||
CombinedStream.prototype.end = function() {
|
||||
this._reset();
|
||||
this.emit('end');
|
||||
};
|
||||
|
||||
CombinedStream.prototype.destroy = function() {
|
||||
this._reset();
|
||||
this.emit('close');
|
||||
};
|
||||
|
||||
CombinedStream.prototype._reset = function() {
|
||||
this.writable = false;
|
||||
this._streams = [];
|
||||
this._currentStream = null;
|
||||
};
|
||||
|
||||
CombinedStream.prototype._checkDataSize = function() {
|
||||
this._updateDataSize();
|
||||
if (this.dataSize <= this.maxDataSize) {
|
||||
return;
|
||||
}
|
||||
|
||||
var message =
|
||||
'DelayedStream#maxDataSize of ' + this.maxDataSize + ' bytes exceeded.';
|
||||
this._emitError(new Error(message));
|
||||
};
|
||||
|
||||
CombinedStream.prototype._updateDataSize = function() {
|
||||
this.dataSize = 0;
|
||||
|
||||
var self = this;
|
||||
this._streams.forEach(function(stream) {
|
||||
if (!stream.dataSize) {
|
||||
return;
|
||||
}
|
||||
|
||||
self.dataSize += stream.dataSize;
|
||||
});
|
||||
|
||||
if (this._currentStream && this._currentStream.dataSize) {
|
||||
this.dataSize += this._currentStream.dataSize;
|
||||
}
|
||||
};
|
||||
|
||||
CombinedStream.prototype._emitError = function(err) {
|
||||
this._reset();
|
||||
this.emit('error', err);
|
||||
};
|
84
node_modules/popsicle/node_modules/combined-stream/package.json
generated
vendored
Normal file
84
node_modules/popsicle/node_modules/combined-stream/package.json
generated
vendored
Normal file
@ -0,0 +1,84 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"combined-stream@~0.0.4",
|
||||
"C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\popsicle\\node_modules\\form-data"
|
||||
]
|
||||
],
|
||||
"_from": "combined-stream@>=0.0.4-0 <0.1.0-0",
|
||||
"_id": "combined-stream@0.0.7",
|
||||
"_inCache": true,
|
||||
"_location": "/popsicle/combined-stream",
|
||||
"_npmUser": {
|
||||
"email": "felix@debuggable.com",
|
||||
"name": "felixge"
|
||||
},
|
||||
"_npmVersion": "1.4.3",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "combined-stream",
|
||||
"raw": "combined-stream@~0.0.4",
|
||||
"rawSpec": "~0.0.4",
|
||||
"scope": null,
|
||||
"spec": ">=0.0.4-0 <0.1.0-0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/popsicle/form-data"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-0.0.7.tgz",
|
||||
"_shasum": "0137e657baa5a7541c57ac37ac5fc07d73b4dc1f",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "combined-stream@~0.0.4",
|
||||
"_where": "C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\popsicle\\node_modules\\form-data",
|
||||
"author": {
|
||||
"email": "felix@debuggable.com",
|
||||
"name": "Felix Geisendörfer",
|
||||
"url": "http://debuggable.com/"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/felixge/node-combined-stream/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"delayed-stream": "0.0.5"
|
||||
},
|
||||
"description": "A stream that emits multiple other streams one after another.",
|
||||
"devDependencies": {
|
||||
"far": "~0.0.7"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "0137e657baa5a7541c57ac37ac5fc07d73b4dc1f",
|
||||
"tarball": "https://registry.npmjs.org/combined-stream/-/combined-stream-0.0.7.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
},
|
||||
"homepage": "https://github.com/felixge/node-combined-stream",
|
||||
"installable": true,
|
||||
"main": "./lib/combined_stream",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "felixge",
|
||||
"email": "felix@debuggable.com"
|
||||
},
|
||||
{
|
||||
"name": "celer",
|
||||
"email": "celer@scrypt.net"
|
||||
},
|
||||
{
|
||||
"name": "alexindigo",
|
||||
"email": "iam@alexindigo.com"
|
||||
}
|
||||
],
|
||||
"name": "combined-stream",
|
||||
"optionalDependencies": {},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/felixge/node-combined-stream.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "node test/run.js"
|
||||
},
|
||||
"version": "0.0.7"
|
||||
}
|
2
node_modules/popsicle/node_modules/delayed-stream/.npmignore
generated
vendored
Normal file
2
node_modules/popsicle/node_modules/delayed-stream/.npmignore
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
*.un~
|
||||
/node_modules/*
|
19
node_modules/popsicle/node_modules/delayed-stream/License
generated
vendored
Normal file
19
node_modules/popsicle/node_modules/delayed-stream/License
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
Copyright (c) 2011 Debuggable Limited <felix@debuggable.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
7
node_modules/popsicle/node_modules/delayed-stream/Makefile
generated
vendored
Normal file
7
node_modules/popsicle/node_modules/delayed-stream/Makefile
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
SHELL := /bin/bash
|
||||
|
||||
test:
|
||||
@./test/run.js
|
||||
|
||||
.PHONY: test
|
||||
|
154
node_modules/popsicle/node_modules/delayed-stream/Readme.md
generated
vendored
Normal file
154
node_modules/popsicle/node_modules/delayed-stream/Readme.md
generated
vendored
Normal file
@ -0,0 +1,154 @@
|
||||
# delayed-stream
|
||||
|
||||
Buffers events from a stream until you are ready to handle them.
|
||||
|
||||
## Installation
|
||||
|
||||
``` bash
|
||||
npm install delayed-stream
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
The following example shows how to write a http echo server that delays its
|
||||
response by 1000 ms.
|
||||
|
||||
``` javascript
|
||||
var DelayedStream = require('delayed-stream');
|
||||
var http = require('http');
|
||||
|
||||
http.createServer(function(req, res) {
|
||||
var delayed = DelayedStream.create(req);
|
||||
|
||||
setTimeout(function() {
|
||||
res.writeHead(200);
|
||||
delayed.pipe(res);
|
||||
}, 1000);
|
||||
});
|
||||
```
|
||||
|
||||
If you are not using `Stream#pipe`, you can also manually release the buffered
|
||||
events by calling `delayedStream.resume()`:
|
||||
|
||||
``` javascript
|
||||
var delayed = DelayedStream.create(req);
|
||||
|
||||
setTimeout(function() {
|
||||
// Emit all buffered events and resume underlaying source
|
||||
delayed.resume();
|
||||
}, 1000);
|
||||
```
|
||||
|
||||
## Implementation
|
||||
|
||||
In order to use this meta stream properly, here are a few things you should
|
||||
know about the implementation.
|
||||
|
||||
### Event Buffering / Proxying
|
||||
|
||||
All events of the `source` stream are hijacked by overwriting the `source.emit`
|
||||
method. Until node implements a catch-all event listener, this is the only way.
|
||||
|
||||
However, delayed-stream still continues to emit all events it captures on the
|
||||
`source`, regardless of whether you have released the delayed stream yet or
|
||||
not.
|
||||
|
||||
Upon creation, delayed-stream captures all `source` events and stores them in
|
||||
an internal event buffer. Once `delayedStream.release()` is called, all
|
||||
buffered events are emitted on the `delayedStream`, and the event buffer is
|
||||
cleared. After that, delayed-stream merely acts as a proxy for the underlaying
|
||||
source.
|
||||
|
||||
### Error handling
|
||||
|
||||
Error events on `source` are buffered / proxied just like any other events.
|
||||
However, `delayedStream.create` attaches a no-op `'error'` listener to the
|
||||
`source`. This way you only have to handle errors on the `delayedStream`
|
||||
object, rather than in two places.
|
||||
|
||||
### Buffer limits
|
||||
|
||||
delayed-stream provides a `maxDataSize` property that can be used to limit
|
||||
the amount of data being buffered. In order to protect you from bad `source`
|
||||
streams that don't react to `source.pause()`, this feature is enabled by
|
||||
default.
|
||||
|
||||
## API
|
||||
|
||||
### DelayedStream.create(source, [options])
|
||||
|
||||
Returns a new `delayedStream`. Available options are:
|
||||
|
||||
* `pauseStream`
|
||||
* `maxDataSize`
|
||||
|
||||
The description for those properties can be found below.
|
||||
|
||||
### delayedStream.source
|
||||
|
||||
The `source` stream managed by this object. This is useful if you are
|
||||
passing your `delayedStream` around, and you still want to access properties
|
||||
on the `source` object.
|
||||
|
||||
### delayedStream.pauseStream = true
|
||||
|
||||
Whether to pause the underlaying `source` when calling
|
||||
`DelayedStream.create()`. Modifying this property afterwards has no effect.
|
||||
|
||||
### delayedStream.maxDataSize = 1024 * 1024
|
||||
|
||||
The amount of data to buffer before emitting an `error`.
|
||||
|
||||
If the underlaying source is emitting `Buffer` objects, the `maxDataSize`
|
||||
refers to bytes.
|
||||
|
||||
If the underlaying source is emitting JavaScript strings, the size refers to
|
||||
characters.
|
||||
|
||||
If you know what you are doing, you can set this property to `Infinity` to
|
||||
disable this feature. You can also modify this property during runtime.
|
||||
|
||||
### delayedStream.maxDataSize = 1024 * 1024
|
||||
|
||||
The amount of data to buffer before emitting an `error`.
|
||||
|
||||
If the underlaying source is emitting `Buffer` objects, the `maxDataSize`
|
||||
refers to bytes.
|
||||
|
||||
If the underlaying source is emitting JavaScript strings, the size refers to
|
||||
characters.
|
||||
|
||||
If you know what you are doing, you can set this property to `Infinity` to
|
||||
disable this feature.
|
||||
|
||||
### delayedStream.dataSize = 0
|
||||
|
||||
The amount of data buffered so far.
|
||||
|
||||
### delayedStream.readable
|
||||
|
||||
An ECMA5 getter that returns the value of `source.readable`.
|
||||
|
||||
### delayedStream.resume()
|
||||
|
||||
If the `delayedStream` has not been released so far, `delayedStream.release()`
|
||||
is called.
|
||||
|
||||
In either case, `source.resume()` is called.
|
||||
|
||||
### delayedStream.pause()
|
||||
|
||||
Calls `source.pause()`.
|
||||
|
||||
### delayedStream.pipe(dest)
|
||||
|
||||
Calls `delayedStream.resume()` and then proxies the arguments to `source.pipe`.
|
||||
|
||||
### delayedStream.release()
|
||||
|
||||
Emits and clears all events that have been buffered up so far. This does not
|
||||
resume the underlaying source, use `delayedStream.resume()` instead.
|
||||
|
||||
## License
|
||||
|
||||
delayed-stream is licensed under the MIT license.
|
99
node_modules/popsicle/node_modules/delayed-stream/lib/delayed_stream.js
generated
vendored
Normal file
99
node_modules/popsicle/node_modules/delayed-stream/lib/delayed_stream.js
generated
vendored
Normal file
@ -0,0 +1,99 @@
|
||||
var Stream = require('stream').Stream;
|
||||
var util = require('util');
|
||||
|
||||
module.exports = DelayedStream;
|
||||
function DelayedStream() {
|
||||
this.source = null;
|
||||
this.dataSize = 0;
|
||||
this.maxDataSize = 1024 * 1024;
|
||||
this.pauseStream = true;
|
||||
|
||||
this._maxDataSizeExceeded = false;
|
||||
this._released = false;
|
||||
this._bufferedEvents = [];
|
||||
}
|
||||
util.inherits(DelayedStream, Stream);
|
||||
|
||||
DelayedStream.create = function(source, options) {
|
||||
var delayedStream = new this();
|
||||
|
||||
options = options || {};
|
||||
for (var option in options) {
|
||||
delayedStream[option] = options[option];
|
||||
}
|
||||
|
||||
delayedStream.source = source;
|
||||
|
||||
var realEmit = source.emit;
|
||||
source.emit = function() {
|
||||
delayedStream._handleEmit(arguments);
|
||||
return realEmit.apply(source, arguments);
|
||||
};
|
||||
|
||||
source.on('error', function() {});
|
||||
if (delayedStream.pauseStream) {
|
||||
source.pause();
|
||||
}
|
||||
|
||||
return delayedStream;
|
||||
};
|
||||
|
||||
DelayedStream.prototype.__defineGetter__('readable', function() {
|
||||
return this.source.readable;
|
||||
});
|
||||
|
||||
DelayedStream.prototype.resume = function() {
|
||||
if (!this._released) {
|
||||
this.release();
|
||||
}
|
||||
|
||||
this.source.resume();
|
||||
};
|
||||
|
||||
DelayedStream.prototype.pause = function() {
|
||||
this.source.pause();
|
||||
};
|
||||
|
||||
DelayedStream.prototype.release = function() {
|
||||
this._released = true;
|
||||
|
||||
this._bufferedEvents.forEach(function(args) {
|
||||
this.emit.apply(this, args);
|
||||
}.bind(this));
|
||||
this._bufferedEvents = [];
|
||||
};
|
||||
|
||||
DelayedStream.prototype.pipe = function() {
|
||||
var r = Stream.prototype.pipe.apply(this, arguments);
|
||||
this.resume();
|
||||
return r;
|
||||
};
|
||||
|
||||
DelayedStream.prototype._handleEmit = function(args) {
|
||||
if (this._released) {
|
||||
this.emit.apply(this, args);
|
||||
return;
|
||||
}
|
||||
|
||||
if (args[0] === 'data') {
|
||||
this.dataSize += args[1].length;
|
||||
this._checkIfMaxDataSizeExceeded();
|
||||
}
|
||||
|
||||
this._bufferedEvents.push(args);
|
||||
};
|
||||
|
||||
DelayedStream.prototype._checkIfMaxDataSizeExceeded = function() {
|
||||
if (this._maxDataSizeExceeded) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.dataSize <= this.maxDataSize) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._maxDataSizeExceeded = true;
|
||||
var message =
|
||||
'DelayedStream#maxDataSize of ' + this.maxDataSize + ' bytes exceeded.'
|
||||
this.emit('error', new Error(message));
|
||||
};
|
63
node_modules/popsicle/node_modules/delayed-stream/package.json
generated
vendored
Normal file
63
node_modules/popsicle/node_modules/delayed-stream/package.json
generated
vendored
Normal file
@ -0,0 +1,63 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"delayed-stream@0.0.5",
|
||||
"C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\popsicle\\node_modules\\combined-stream"
|
||||
]
|
||||
],
|
||||
"_defaultsLoaded": true,
|
||||
"_engineSupported": true,
|
||||
"_from": "delayed-stream@0.0.5",
|
||||
"_id": "delayed-stream@0.0.5",
|
||||
"_inCache": true,
|
||||
"_location": "/popsicle/delayed-stream",
|
||||
"_nodeVersion": "v0.4.9-pre",
|
||||
"_npmVersion": "1.0.3",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "delayed-stream",
|
||||
"raw": "delayed-stream@0.0.5",
|
||||
"rawSpec": "0.0.5",
|
||||
"scope": null,
|
||||
"spec": "0.0.5",
|
||||
"type": "version"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/popsicle/combined-stream"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-0.0.5.tgz",
|
||||
"_shasum": "d4b1f43a93e8296dfe02694f4680bc37a313c73f",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "delayed-stream@0.0.5",
|
||||
"_where": "C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\popsicle\\node_modules\\combined-stream",
|
||||
"author": {
|
||||
"email": "felix@debuggable.com",
|
||||
"name": "Felix Geisendörfer",
|
||||
"url": "http://debuggable.com/"
|
||||
},
|
||||
"dependencies": {},
|
||||
"description": "Buffers events from a stream until you are ready to handle them.",
|
||||
"devDependencies": {
|
||||
"fake": "0.2.0",
|
||||
"far": "0.0.1"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "d4b1f43a93e8296dfe02694f4680bc37a313c73f",
|
||||
"tarball": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-0.0.5.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.4.0"
|
||||
},
|
||||
"homepage": "https://github.com/felixge/node-delayed-stream",
|
||||
"installable": true,
|
||||
"main": "./lib/delayed_stream",
|
||||
"name": "delayed-stream",
|
||||
"optionalDependencies": {},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/felixge/node-delayed-stream.git"
|
||||
},
|
||||
"scripts": {},
|
||||
"version": "0.0.5"
|
||||
}
|
6
node_modules/popsicle/node_modules/delayed-stream/test/common.js
generated
vendored
Normal file
6
node_modules/popsicle/node_modules/delayed-stream/test/common.js
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
var common = module.exports;
|
||||
|
||||
common.DelayedStream = require('..');
|
||||
common.assert = require('assert');
|
||||
common.fake = require('fake');
|
||||
common.PORT = 49252;
|
38
node_modules/popsicle/node_modules/delayed-stream/test/integration/test-delayed-http-upload.js
generated
vendored
Normal file
38
node_modules/popsicle/node_modules/delayed-stream/test/integration/test-delayed-http-upload.js
generated
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
var common = require('../common');
|
||||
var assert = common.assert;
|
||||
var DelayedStream = common.DelayedStream;
|
||||
var http = require('http');
|
||||
|
||||
var UPLOAD = new Buffer(10 * 1024 * 1024);
|
||||
|
||||
var server = http.createServer(function(req, res) {
|
||||
var delayed = DelayedStream.create(req, {maxDataSize: UPLOAD.length});
|
||||
|
||||
setTimeout(function() {
|
||||
res.writeHead(200);
|
||||
delayed.pipe(res);
|
||||
}, 10);
|
||||
});
|
||||
server.listen(common.PORT, function() {
|
||||
var request = http.request({
|
||||
method: 'POST',
|
||||
port: common.PORT,
|
||||
});
|
||||
|
||||
request.write(UPLOAD);
|
||||
request.end();
|
||||
|
||||
request.on('response', function(res) {
|
||||
var received = 0;
|
||||
res
|
||||
.on('data', function(chunk) {
|
||||
received += chunk.length;
|
||||
})
|
||||
.on('end', function() {
|
||||
assert.equal(received, UPLOAD.length);
|
||||
server.close();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
21
node_modules/popsicle/node_modules/delayed-stream/test/integration/test-delayed-stream-auto-pause.js
generated
vendored
Normal file
21
node_modules/popsicle/node_modules/delayed-stream/test/integration/test-delayed-stream-auto-pause.js
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
var common = require('../common');
|
||||
var assert = common.assert;
|
||||
var fake = common.fake.create();
|
||||
var DelayedStream = common.DelayedStream;
|
||||
var Stream = require('stream').Stream;
|
||||
|
||||
(function testAutoPause() {
|
||||
var source = new Stream();
|
||||
|
||||
fake.expect(source, 'pause', 1);
|
||||
var delayedStream = DelayedStream.create(source);
|
||||
fake.verify();
|
||||
})();
|
||||
|
||||
(function testDisableAutoPause() {
|
||||
var source = new Stream();
|
||||
fake.expect(source, 'pause', 0);
|
||||
|
||||
var delayedStream = DelayedStream.create(source, {pauseStream: false});
|
||||
fake.verify();
|
||||
})();
|
14
node_modules/popsicle/node_modules/delayed-stream/test/integration/test-delayed-stream-pause.js
generated
vendored
Normal file
14
node_modules/popsicle/node_modules/delayed-stream/test/integration/test-delayed-stream-pause.js
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
var common = require('../common');
|
||||
var assert = common.assert;
|
||||
var fake = common.fake.create();
|
||||
var DelayedStream = common.DelayedStream;
|
||||
var Stream = require('stream').Stream;
|
||||
|
||||
(function testDelayEventsUntilResume() {
|
||||
var source = new Stream();
|
||||
var delayedStream = DelayedStream.create(source, {pauseStream: false});
|
||||
|
||||
fake.expect(source, 'pause');
|
||||
delayedStream.pause();
|
||||
fake.verify();
|
||||
})();
|
48
node_modules/popsicle/node_modules/delayed-stream/test/integration/test-delayed-stream.js
generated
vendored
Normal file
48
node_modules/popsicle/node_modules/delayed-stream/test/integration/test-delayed-stream.js
generated
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
var common = require('../common');
|
||||
var assert = common.assert;
|
||||
var fake = common.fake.create();
|
||||
var DelayedStream = common.DelayedStream;
|
||||
var Stream = require('stream').Stream;
|
||||
|
||||
(function testDelayEventsUntilResume() {
|
||||
var source = new Stream();
|
||||
var delayedStream = DelayedStream.create(source, {pauseStream: false});
|
||||
|
||||
// delayedStream must not emit until we resume
|
||||
fake.expect(delayedStream, 'emit', 0);
|
||||
|
||||
// but our original source must emit
|
||||
var params = [];
|
||||
source.on('foo', function(param) {
|
||||
params.push(param);
|
||||
});
|
||||
|
||||
source.emit('foo', 1);
|
||||
source.emit('foo', 2);
|
||||
|
||||
// Make sure delayedStream did not emit, and source did
|
||||
assert.deepEqual(params, [1, 2]);
|
||||
fake.verify();
|
||||
|
||||
// After resume, delayedStream must playback all events
|
||||
fake
|
||||
.stub(delayedStream, 'emit')
|
||||
.times(Infinity)
|
||||
.withArg(1, 'newListener');
|
||||
fake.expect(delayedStream, 'emit', ['foo', 1]);
|
||||
fake.expect(delayedStream, 'emit', ['foo', 2]);
|
||||
fake.expect(source, 'resume');
|
||||
|
||||
delayedStream.resume();
|
||||
fake.verify();
|
||||
|
||||
// Calling resume again will delegate to source
|
||||
fake.expect(source, 'resume');
|
||||
delayedStream.resume();
|
||||
fake.verify();
|
||||
|
||||
// Emitting more events directly leads to them being emitted
|
||||
fake.expect(delayedStream, 'emit', ['foo', 3]);
|
||||
source.emit('foo', 3);
|
||||
fake.verify();
|
||||
})();
|
15
node_modules/popsicle/node_modules/delayed-stream/test/integration/test-handle-source-errors.js
generated
vendored
Normal file
15
node_modules/popsicle/node_modules/delayed-stream/test/integration/test-handle-source-errors.js
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
var common = require('../common');
|
||||
var assert = common.assert;
|
||||
var fake = common.fake.create();
|
||||
var DelayedStream = common.DelayedStream;
|
||||
var Stream = require('stream').Stream;
|
||||
|
||||
(function testHandleSourceErrors() {
|
||||
var source = new Stream();
|
||||
var delayedStream = DelayedStream.create(source, {pauseStream: false});
|
||||
|
||||
// We deal with this by attaching a no-op listener to 'error' on the source
|
||||
// when creating a new DelayedStream. This way error events on the source
|
||||
// won't throw.
|
||||
source.emit('error', new Error('something went wrong'));
|
||||
})();
|
18
node_modules/popsicle/node_modules/delayed-stream/test/integration/test-max-data-size.js
generated
vendored
Normal file
18
node_modules/popsicle/node_modules/delayed-stream/test/integration/test-max-data-size.js
generated
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
var common = require('../common');
|
||||
var assert = common.assert;
|
||||
var fake = common.fake.create();
|
||||
var DelayedStream = common.DelayedStream;
|
||||
var Stream = require('stream').Stream;
|
||||
|
||||
(function testMaxDataSize() {
|
||||
var source = new Stream();
|
||||
var delayedStream = DelayedStream.create(source, {maxDataSize: 1024, pauseStream: false});
|
||||
|
||||
source.emit('data', new Buffer(1024));
|
||||
|
||||
fake
|
||||
.expect(delayedStream, 'emit')
|
||||
.withArg(1, 'error');
|
||||
source.emit('data', new Buffer(1));
|
||||
fake.verify();
|
||||
})();
|
13
node_modules/popsicle/node_modules/delayed-stream/test/integration/test-pipe-resumes.js
generated
vendored
Normal file
13
node_modules/popsicle/node_modules/delayed-stream/test/integration/test-pipe-resumes.js
generated
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
var common = require('../common');
|
||||
var assert = common.assert;
|
||||
var fake = common.fake.create();
|
||||
var DelayedStream = common.DelayedStream;
|
||||
var Stream = require('stream').Stream;
|
||||
|
||||
(function testPipeReleases() {
|
||||
var source = new Stream();
|
||||
var delayedStream = DelayedStream.create(source, {pauseStream: false});
|
||||
|
||||
fake.expect(delayedStream, 'resume');
|
||||
delayedStream.pipe(new Stream());
|
||||
})();
|
13
node_modules/popsicle/node_modules/delayed-stream/test/integration/test-proxy-readable.js
generated
vendored
Normal file
13
node_modules/popsicle/node_modules/delayed-stream/test/integration/test-proxy-readable.js
generated
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
var common = require('../common');
|
||||
var assert = common.assert;
|
||||
var fake = common.fake.create();
|
||||
var DelayedStream = common.DelayedStream;
|
||||
var Stream = require('stream').Stream;
|
||||
|
||||
(function testProxyReadableProperty() {
|
||||
var source = new Stream();
|
||||
var delayedStream = DelayedStream.create(source, {pauseStream: false});
|
||||
|
||||
source.readable = fake.value('source.readable');
|
||||
assert.strictEqual(delayedStream.readable, source.readable);
|
||||
})();
|
7
node_modules/popsicle/node_modules/delayed-stream/test/run.js
generated
vendored
Normal file
7
node_modules/popsicle/node_modules/delayed-stream/test/run.js
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env node
|
||||
var far = require('far').create();
|
||||
|
||||
far.add(__dirname);
|
||||
far.include(/test-.*\.js$/);
|
||||
|
||||
far.execute();
|
19
node_modules/popsicle/node_modules/form-data/License
generated
vendored
Normal file
19
node_modules/popsicle/node_modules/form-data/License
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
Copyright (c) 2012 Felix Geisendörfer (felix@debuggable.com) and contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
175
node_modules/popsicle/node_modules/form-data/Readme.md
generated
vendored
Normal file
175
node_modules/popsicle/node_modules/form-data/Readme.md
generated
vendored
Normal file
@ -0,0 +1,175 @@
|
||||
# Form-Data [](https://travis-ci.org/felixge/node-form-data) [](https://gemnasium.com/felixge/node-form-data)
|
||||
|
||||
A module to create readable ```"multipart/form-data"``` streams. Can be used to submit forms and file uploads to other web applications.
|
||||
|
||||
The API of this module is inspired by the [XMLHttpRequest-2 FormData Interface][xhr2-fd].
|
||||
|
||||
[xhr2-fd]: http://dev.w3.org/2006/webapi/XMLHttpRequest-2/Overview.html#the-formdata-interface
|
||||
[streams2-thing]: http://nodejs.org/api/stream.html#stream_compatibility_with_older_node_versions
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
npm install form-data
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
In this example we are constructing a form with 3 fields that contain a string,
|
||||
a buffer and a file stream.
|
||||
|
||||
``` javascript
|
||||
var FormData = require('form-data');
|
||||
var fs = require('fs');
|
||||
|
||||
var form = new FormData();
|
||||
form.append('my_field', 'my value');
|
||||
form.append('my_buffer', new Buffer(10));
|
||||
form.append('my_file', fs.createReadStream('/foo/bar.jpg'));
|
||||
```
|
||||
|
||||
Also you can use http-response stream:
|
||||
|
||||
``` javascript
|
||||
var FormData = require('form-data');
|
||||
var http = require('http');
|
||||
|
||||
var form = new FormData();
|
||||
|
||||
http.request('http://nodejs.org/images/logo.png', function(response) {
|
||||
form.append('my_field', 'my value');
|
||||
form.append('my_buffer', new Buffer(10));
|
||||
form.append('my_logo', response);
|
||||
});
|
||||
```
|
||||
|
||||
Or @mikeal's request stream:
|
||||
|
||||
``` javascript
|
||||
var FormData = require('form-data');
|
||||
var request = require('request');
|
||||
|
||||
var form = new FormData();
|
||||
|
||||
form.append('my_field', 'my value');
|
||||
form.append('my_buffer', new Buffer(10));
|
||||
form.append('my_logo', request('http://nodejs.org/images/logo.png'));
|
||||
```
|
||||
|
||||
In order to submit this form to a web application, call ```submit(url, [callback])``` method:
|
||||
|
||||
``` javascript
|
||||
form.submit('http://example.org/', function(err, res) {
|
||||
// res – response object (http.IncomingMessage) //
|
||||
res.resume(); // for node-0.10.x
|
||||
});
|
||||
|
||||
```
|
||||
|
||||
For more advanced request manipulations ```submit()``` method returns ```http.ClientRequest``` object, or you can choose from one of the alternative submission methods.
|
||||
|
||||
### Alternative submission methods
|
||||
|
||||
You can use node's http client interface:
|
||||
|
||||
``` javascript
|
||||
var http = require('http');
|
||||
|
||||
var request = http.request({
|
||||
method: 'post',
|
||||
host: 'example.org',
|
||||
path: '/upload',
|
||||
headers: form.getHeaders()
|
||||
});
|
||||
|
||||
form.pipe(request);
|
||||
|
||||
request.on('response', function(res) {
|
||||
console.log(res.statusCode);
|
||||
});
|
||||
```
|
||||
|
||||
Or if you would prefer the `'Content-Length'` header to be set for you:
|
||||
|
||||
``` javascript
|
||||
form.submit('example.org/upload', function(err, res) {
|
||||
console.log(res.statusCode);
|
||||
});
|
||||
```
|
||||
|
||||
To use custom headers and pre-known length in parts:
|
||||
|
||||
``` javascript
|
||||
var CRLF = '\r\n';
|
||||
var form = new FormData();
|
||||
|
||||
var options = {
|
||||
header: CRLF + '--' + form.getBoundary() + CRLF + 'X-Custom-Header: 123' + CRLF + CRLF,
|
||||
knownLength: 1
|
||||
};
|
||||
|
||||
form.append('my_buffer', buffer, options);
|
||||
|
||||
form.submit('http://example.com/', function(err, res) {
|
||||
if (err) throw err;
|
||||
console.log('Done');
|
||||
});
|
||||
```
|
||||
|
||||
Form-Data can recognize and fetch all the required information from common types of streams (```fs.readStream```, ```http.response``` and ```mikeal's request```), for some other types of streams you'd need to provide "file"-related information manually:
|
||||
|
||||
``` javascript
|
||||
someModule.stream(function(err, stdout, stderr) {
|
||||
if (err) throw err;
|
||||
|
||||
var form = new FormData();
|
||||
|
||||
form.append('file', stdout, {
|
||||
filename: 'unicycle.jpg',
|
||||
contentType: 'image/jpg',
|
||||
knownLength: 19806
|
||||
});
|
||||
|
||||
form.submit('http://example.com/', function(err, res) {
|
||||
if (err) throw err;
|
||||
console.log('Done');
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
For edge cases, like POST request to URL with query string or to pass HTTP auth credentials, object can be passed to `form.submit()` as first parameter:
|
||||
|
||||
``` javascript
|
||||
form.submit({
|
||||
host: 'example.com',
|
||||
path: '/probably.php?extra=params',
|
||||
auth: 'username:password'
|
||||
}, function(err, res) {
|
||||
console.log(res.statusCode);
|
||||
});
|
||||
```
|
||||
|
||||
In case you need to also send custom HTTP headers with the POST request, you can use the `headers` key in first parameter of `form.submit()`:
|
||||
|
||||
``` javascript
|
||||
form.submit({
|
||||
host: 'example.com',
|
||||
path: '/surelynot.php',
|
||||
headers: {'x-test-header': 'test-header-value'}
|
||||
}, function(err, res) {
|
||||
console.log(res.statusCode);
|
||||
});
|
||||
```
|
||||
|
||||
## Notes
|
||||
|
||||
- ```getLengthSync()``` method DOESN'T calculate length for streams, use ```knownLength``` options as workaround.
|
||||
- If it feels like FormData hangs after submit and you're on ```node-0.10```, please check [Compatibility with Older Node Versions][streams2-thing]
|
||||
|
||||
## TODO
|
||||
|
||||
- Add new streams (0.10) support and try really hard not to break it for 0.8.x.
|
||||
|
||||
## License
|
||||
|
||||
Form-Data is licensed under the MIT license.
|
351
node_modules/popsicle/node_modules/form-data/lib/form_data.js
generated
vendored
Normal file
351
node_modules/popsicle/node_modules/form-data/lib/form_data.js
generated
vendored
Normal file
@ -0,0 +1,351 @@
|
||||
var CombinedStream = require('combined-stream');
|
||||
var util = require('util');
|
||||
var path = require('path');
|
||||
var http = require('http');
|
||||
var https = require('https');
|
||||
var parseUrl = require('url').parse;
|
||||
var fs = require('fs');
|
||||
var mime = require('mime-types');
|
||||
var async = require('async');
|
||||
|
||||
module.exports = FormData;
|
||||
function FormData() {
|
||||
this._overheadLength = 0;
|
||||
this._valueLength = 0;
|
||||
this._lengthRetrievers = [];
|
||||
|
||||
CombinedStream.call(this);
|
||||
}
|
||||
util.inherits(FormData, CombinedStream);
|
||||
|
||||
FormData.LINE_BREAK = '\r\n';
|
||||
|
||||
FormData.prototype.append = function(field, value, options) {
|
||||
options = options || {};
|
||||
|
||||
var append = CombinedStream.prototype.append.bind(this);
|
||||
|
||||
// all that streamy business can't handle numbers
|
||||
if (typeof value == 'number') value = ''+value;
|
||||
|
||||
// https://github.com/felixge/node-form-data/issues/38
|
||||
if (util.isArray(value)) {
|
||||
// Please convert your array into string
|
||||
// the way web server expects it
|
||||
this._error(new Error('Arrays are not supported.'));
|
||||
return;
|
||||
}
|
||||
|
||||
var header = this._multiPartHeader(field, value, options);
|
||||
var footer = this._multiPartFooter(field, value, options);
|
||||
|
||||
append(header);
|
||||
append(value);
|
||||
append(footer);
|
||||
|
||||
// pass along options.knownLength
|
||||
this._trackLength(header, value, options);
|
||||
};
|
||||
|
||||
FormData.prototype._trackLength = function(header, value, options) {
|
||||
var valueLength = 0;
|
||||
|
||||
// used w/ getLengthSync(), when length is known.
|
||||
// e.g. for streaming directly from a remote server,
|
||||
// w/ a known file a size, and not wanting to wait for
|
||||
// incoming file to finish to get its size.
|
||||
if (options.knownLength != null) {
|
||||
valueLength += +options.knownLength;
|
||||
} else if (Buffer.isBuffer(value)) {
|
||||
valueLength = value.length;
|
||||
} else if (typeof value === 'string') {
|
||||
valueLength = Buffer.byteLength(value);
|
||||
}
|
||||
|
||||
this._valueLength += valueLength;
|
||||
|
||||
// @check why add CRLF? does this account for custom/multiple CRLFs?
|
||||
this._overheadLength +=
|
||||
Buffer.byteLength(header) +
|
||||
+ FormData.LINE_BREAK.length;
|
||||
|
||||
// empty or either doesn't have path or not an http response
|
||||
if (!value || ( !value.path && !(value.readable && value.hasOwnProperty('httpVersion')) )) {
|
||||
return;
|
||||
}
|
||||
|
||||
// no need to bother with the length
|
||||
if (!options.knownLength)
|
||||
this._lengthRetrievers.push(function(next) {
|
||||
|
||||
if (value.hasOwnProperty('fd')) {
|
||||
|
||||
// take read range into a account
|
||||
// `end` = Infinity –> read file till the end
|
||||
//
|
||||
// TODO: Looks like there is bug in Node fs.createReadStream
|
||||
// it doesn't respect `end` options without `start` options
|
||||
// Fix it when node fixes it.
|
||||
// https://github.com/joyent/node/issues/7819
|
||||
if (value.end != undefined && value.end != Infinity && value.start != undefined) {
|
||||
|
||||
// when end specified
|
||||
// no need to calculate range
|
||||
// inclusive, starts with 0
|
||||
next(null, value.end+1 - (value.start ? value.start : 0));
|
||||
|
||||
// not that fast snoopy
|
||||
} else {
|
||||
// still need to fetch file size from fs
|
||||
fs.stat(value.path, function(err, stat) {
|
||||
|
||||
var fileSize;
|
||||
|
||||
if (err) {
|
||||
next(err);
|
||||
return;
|
||||
}
|
||||
|
||||
// update final size based on the range options
|
||||
fileSize = stat.size - (value.start ? value.start : 0);
|
||||
next(null, fileSize);
|
||||
});
|
||||
}
|
||||
|
||||
// or http response
|
||||
} else if (value.hasOwnProperty('httpVersion')) {
|
||||
next(null, +value.headers['content-length']);
|
||||
|
||||
// or request stream http://github.com/mikeal/request
|
||||
} else if (value.hasOwnProperty('httpModule')) {
|
||||
// wait till response come back
|
||||
value.on('response', function(response) {
|
||||
value.pause();
|
||||
next(null, +response.headers['content-length']);
|
||||
});
|
||||
value.resume();
|
||||
|
||||
// something else
|
||||
} else {
|
||||
next('Unknown stream');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
FormData.prototype._multiPartHeader = function(field, value, options) {
|
||||
var boundary = this.getBoundary();
|
||||
var header = '';
|
||||
|
||||
// custom header specified (as string)?
|
||||
// it becomes responsible for boundary
|
||||
// (e.g. to handle extra CRLFs on .NET servers)
|
||||
if (options.header != null) {
|
||||
header = options.header;
|
||||
} else {
|
||||
header += '--' + boundary + FormData.LINE_BREAK +
|
||||
'Content-Disposition: form-data; name="' + field + '"';
|
||||
|
||||
// fs- and request- streams have path property
|
||||
// or use custom filename and/or contentType
|
||||
// TODO: Use request's response mime-type
|
||||
if (options.filename || value.path) {
|
||||
header +=
|
||||
'; filename="' + path.basename(options.filename || value.path) + '"' + FormData.LINE_BREAK +
|
||||
'Content-Type: ' + (options.contentType || mime.lookup(options.filename || value.path));
|
||||
|
||||
// http response has not
|
||||
} else if (value.readable && value.hasOwnProperty('httpVersion')) {
|
||||
header +=
|
||||
'; filename="' + path.basename(value.client._httpMessage.path) + '"' + FormData.LINE_BREAK +
|
||||
'Content-Type: ' + value.headers['content-type'];
|
||||
}
|
||||
|
||||
header += FormData.LINE_BREAK + FormData.LINE_BREAK;
|
||||
}
|
||||
|
||||
return header;
|
||||
};
|
||||
|
||||
FormData.prototype._multiPartFooter = function(field, value, options) {
|
||||
return function(next) {
|
||||
var footer = FormData.LINE_BREAK;
|
||||
|
||||
var lastPart = (this._streams.length === 0);
|
||||
if (lastPart) {
|
||||
footer += this._lastBoundary();
|
||||
}
|
||||
|
||||
next(footer);
|
||||
}.bind(this);
|
||||
};
|
||||
|
||||
FormData.prototype._lastBoundary = function() {
|
||||
return '--' + this.getBoundary() + '--';
|
||||
};
|
||||
|
||||
FormData.prototype.getHeaders = function(userHeaders) {
|
||||
var formHeaders = {
|
||||
'content-type': 'multipart/form-data; boundary=' + this.getBoundary()
|
||||
};
|
||||
|
||||
for (var header in userHeaders) {
|
||||
formHeaders[header.toLowerCase()] = userHeaders[header];
|
||||
}
|
||||
|
||||
return formHeaders;
|
||||
}
|
||||
|
||||
FormData.prototype.getCustomHeaders = function(contentType) {
|
||||
contentType = contentType ? contentType : 'multipart/form-data';
|
||||
|
||||
var formHeaders = {
|
||||
'content-type': contentType + '; boundary=' + this.getBoundary(),
|
||||
'content-length': this.getLengthSync()
|
||||
};
|
||||
|
||||
return formHeaders;
|
||||
}
|
||||
|
||||
FormData.prototype.getBoundary = function() {
|
||||
if (!this._boundary) {
|
||||
this._generateBoundary();
|
||||
}
|
||||
|
||||
return this._boundary;
|
||||
};
|
||||
|
||||
FormData.prototype._generateBoundary = function() {
|
||||
// This generates a 50 character boundary similar to those used by Firefox.
|
||||
// They are optimized for boyer-moore parsing.
|
||||
var boundary = '--------------------------';
|
||||
for (var i = 0; i < 24; i++) {
|
||||
boundary += Math.floor(Math.random() * 10).toString(16);
|
||||
}
|
||||
|
||||
this._boundary = boundary;
|
||||
};
|
||||
|
||||
// Note: getLengthSync DOESN'T calculate streams length
|
||||
// As workaround one can calculate file size manually
|
||||
// and add it as knownLength option
|
||||
FormData.prototype.getLengthSync = function(debug) {
|
||||
var knownLength = this._overheadLength + this._valueLength;
|
||||
|
||||
// Don't get confused, there are 3 "internal" streams for each keyval pair
|
||||
// so it basically checks if there is any value added to the form
|
||||
if (this._streams.length) {
|
||||
knownLength += this._lastBoundary().length;
|
||||
}
|
||||
|
||||
// https://github.com/felixge/node-form-data/issues/40
|
||||
if (this._lengthRetrievers.length) {
|
||||
// Some async length retrivers are present
|
||||
// therefore synchronous length calculation is false.
|
||||
// Please use getLength(callback) to get proper length
|
||||
this._error(new Error('Cannot calculate proper length in synchronous way.'));
|
||||
}
|
||||
|
||||
return knownLength;
|
||||
};
|
||||
|
||||
FormData.prototype.getLength = function(cb) {
|
||||
var knownLength = this._overheadLength + this._valueLength;
|
||||
|
||||
if (this._streams.length) {
|
||||
knownLength += this._lastBoundary().length;
|
||||
}
|
||||
|
||||
if (!this._lengthRetrievers.length) {
|
||||
process.nextTick(cb.bind(this, null, knownLength));
|
||||
return;
|
||||
}
|
||||
|
||||
async.parallel(this._lengthRetrievers, function(err, values) {
|
||||
if (err) {
|
||||
cb(err);
|
||||
return;
|
||||
}
|
||||
|
||||
values.forEach(function(length) {
|
||||
knownLength += length;
|
||||
});
|
||||
|
||||
cb(null, knownLength);
|
||||
});
|
||||
};
|
||||
|
||||
FormData.prototype.submit = function(params, cb) {
|
||||
|
||||
var request
|
||||
, options
|
||||
, defaults = {
|
||||
method : 'post'
|
||||
};
|
||||
|
||||
// parse provided url if it's string
|
||||
// or treat it as options object
|
||||
if (typeof params == 'string') {
|
||||
params = parseUrl(params);
|
||||
|
||||
options = populate({
|
||||
port: params.port,
|
||||
path: params.pathname,
|
||||
host: params.hostname
|
||||
}, defaults);
|
||||
}
|
||||
else // use custom params
|
||||
{
|
||||
options = populate(params, defaults);
|
||||
// if no port provided use default one
|
||||
if (!options.port) {
|
||||
options.port = options.protocol == 'https:' ? 443 : 80;
|
||||
}
|
||||
}
|
||||
|
||||
// put that good code in getHeaders to some use
|
||||
options.headers = this.getHeaders(params.headers);
|
||||
|
||||
// https if specified, fallback to http in any other case
|
||||
if (params.protocol == 'https:') {
|
||||
request = https.request(options);
|
||||
} else {
|
||||
request = http.request(options);
|
||||
}
|
||||
|
||||
// get content length and fire away
|
||||
this.getLength(function(err, length) {
|
||||
|
||||
// TODO: Add chunked encoding when no length (if err)
|
||||
|
||||
// add content length
|
||||
request.setHeader('Content-Length', length);
|
||||
|
||||
this.pipe(request);
|
||||
if (cb) {
|
||||
request.on('error', cb);
|
||||
request.on('response', cb.bind(this, null));
|
||||
}
|
||||
}.bind(this));
|
||||
|
||||
return request;
|
||||
};
|
||||
|
||||
FormData.prototype._error = function(err) {
|
||||
if (this.error) return;
|
||||
|
||||
this.error = err;
|
||||
this.pause();
|
||||
this.emit('error', err);
|
||||
};
|
||||
|
||||
/*
|
||||
* Santa's little helpers
|
||||
*/
|
||||
|
||||
// populates missing values
|
||||
function populate(dst, src) {
|
||||
for (var prop in src) {
|
||||
if (!dst[prop]) dst[prop] = src[prop];
|
||||
}
|
||||
return dst;
|
||||
}
|
104
node_modules/popsicle/node_modules/form-data/package.json
generated
vendored
Normal file
104
node_modules/popsicle/node_modules/form-data/package.json
generated
vendored
Normal file
@ -0,0 +1,104 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"form-data@^0.2.0",
|
||||
"C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\popsicle"
|
||||
]
|
||||
],
|
||||
"_from": "form-data@>=0.2.0-0 <0.3.0-0",
|
||||
"_id": "form-data@0.2.0",
|
||||
"_inCache": true,
|
||||
"_location": "/popsicle/form-data",
|
||||
"_npmUser": {
|
||||
"email": "iam@alexindigo.com",
|
||||
"name": "alexindigo"
|
||||
},
|
||||
"_npmVersion": "1.4.28",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "form-data",
|
||||
"raw": "form-data@^0.2.0",
|
||||
"rawSpec": "^0.2.0",
|
||||
"scope": null,
|
||||
"spec": ">=0.2.0-0 <0.3.0-0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/popsicle"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/form-data/-/form-data-0.2.0.tgz",
|
||||
"_shasum": "26f8bc26da6440e299cbdcfb69035c4f77a6e466",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "form-data@^0.2.0",
|
||||
"_where": "C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\popsicle",
|
||||
"author": {
|
||||
"email": "felix@debuggable.com",
|
||||
"name": "Felix Geisendörfer",
|
||||
"url": "http://debuggable.com/"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/felixge/node-form-data/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"async": "~0.9.0",
|
||||
"combined-stream": "~0.0.4",
|
||||
"mime-types": "~2.0.3"
|
||||
},
|
||||
"description": "A module to create readable \"multipart/form-data\" streams. Can be used to submit forms and file uploads to other web applications.",
|
||||
"devDependencies": {
|
||||
"fake": "~0.2.2",
|
||||
"far": "~0.0.7",
|
||||
"formidable": "~1.0.14",
|
||||
"request": "~2.36.0"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "26f8bc26da6440e299cbdcfb69035c4f77a6e466",
|
||||
"tarball": "https://registry.npmjs.org/form-data/-/form-data-0.2.0.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
},
|
||||
"gitHead": "dfc1a2aef40b97807e2ffe477da06cb2c37e259f",
|
||||
"homepage": "https://github.com/felixge/node-form-data",
|
||||
"installable": true,
|
||||
"licenses": [
|
||||
{
|
||||
"type": "MIT",
|
||||
"url": "https://raw.github.com/felixge/node-form-data/master/License"
|
||||
}
|
||||
],
|
||||
"main": "./lib/form_data",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "felixge",
|
||||
"email": "felix@debuggable.com"
|
||||
},
|
||||
{
|
||||
"name": "idralyuk",
|
||||
"email": "igor@buran.us"
|
||||
},
|
||||
{
|
||||
"name": "alexindigo",
|
||||
"email": "iam@alexindigo.com"
|
||||
},
|
||||
{
|
||||
"name": "mikeal",
|
||||
"email": "mikeal.rogers@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "celer",
|
||||
"email": "dtyree77@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "form-data",
|
||||
"optionalDependencies": {},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/felixge/node-form-data.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "node test/run.js"
|
||||
},
|
||||
"version": "0.2.0"
|
||||
}
|
212
node_modules/popsicle/node_modules/mime-db/HISTORY.md
generated
vendored
Normal file
212
node_modules/popsicle/node_modules/mime-db/HISTORY.md
generated
vendored
Normal file
@ -0,0 +1,212 @@
|
||||
1.12.0 / 2015-06-05
|
||||
===================
|
||||
|
||||
* Add `application/bdoc`
|
||||
* Add `application/vnd.hyperdrive+json`
|
||||
* Add `application/x-bdoc`
|
||||
* Add extension `.rtf` to `text/rtf`
|
||||
|
||||
1.11.0 / 2015-05-31
|
||||
===================
|
||||
|
||||
* Add `audio/wav`
|
||||
* Add `audio/wave`
|
||||
* Add extension `.litcoffee` to `text/coffeescript`
|
||||
* Add extension `.sfd-hdstx` to `application/vnd.hydrostatix.sof-data`
|
||||
* Add extension `.n-gage` to `application/vnd.nokia.n-gage.symbian.install`
|
||||
|
||||
1.10.0 / 2015-05-19
|
||||
===================
|
||||
|
||||
* Add `application/vnd.balsamiq.bmpr`
|
||||
* Add `application/vnd.microsoft.portable-executable`
|
||||
* Add `application/x-ns-proxy-autoconfig`
|
||||
|
||||
1.9.1 / 2015-04-19
|
||||
==================
|
||||
|
||||
* Remove `.json` extension from `application/manifest+json`
|
||||
- This is causing bugs downstream
|
||||
|
||||
1.9.0 / 2015-04-19
|
||||
==================
|
||||
|
||||
* Add `application/manifest+json`
|
||||
* Add `application/vnd.micro+json`
|
||||
* Add `image/vnd.zbrush.pcx`
|
||||
* Add `image/x-ms-bmp`
|
||||
|
||||
1.8.0 / 2015-03-13
|
||||
==================
|
||||
|
||||
* Add `application/vnd.citationstyles.style+xml`
|
||||
* Add `application/vnd.fastcopy-disk-image`
|
||||
* Add `application/vnd.gov.sk.xmldatacontainer+xml`
|
||||
* Add extension `.jsonld` to `application/ld+json`
|
||||
|
||||
1.7.0 / 2015-02-08
|
||||
==================
|
||||
|
||||
* Add `application/vnd.gerber`
|
||||
* Add `application/vnd.msa-disk-image`
|
||||
|
||||
1.6.1 / 2015-02-05
|
||||
==================
|
||||
|
||||
* Community extensions ownership transferred from `node-mime`
|
||||
|
||||
1.6.0 / 2015-01-29
|
||||
==================
|
||||
|
||||
* Add `application/jose`
|
||||
* Add `application/jose+json`
|
||||
* Add `application/json-seq`
|
||||
* Add `application/jwk+json`
|
||||
* Add `application/jwk-set+json`
|
||||
* Add `application/jwt`
|
||||
* Add `application/rdap+json`
|
||||
* Add `application/vnd.gov.sk.e-form+xml`
|
||||
* Add `application/vnd.ims.imsccv1p3`
|
||||
|
||||
1.5.0 / 2014-12-30
|
||||
==================
|
||||
|
||||
* Add `application/vnd.oracle.resource+json`
|
||||
* Fix various invalid MIME type entries
|
||||
- `application/mbox+xml`
|
||||
- `application/oscp-response`
|
||||
- `application/vwg-multiplexed`
|
||||
- `audio/g721`
|
||||
|
||||
1.4.0 / 2014-12-21
|
||||
==================
|
||||
|
||||
* Add `application/vnd.ims.imsccv1p2`
|
||||
* Fix various invalid MIME type entries
|
||||
- `application/vnd-acucobol`
|
||||
- `application/vnd-curl`
|
||||
- `application/vnd-dart`
|
||||
- `application/vnd-dxr`
|
||||
- `application/vnd-fdf`
|
||||
- `application/vnd-mif`
|
||||
- `application/vnd-sema`
|
||||
- `application/vnd-wap-wmlc`
|
||||
- `application/vnd.adobe.flash-movie`
|
||||
- `application/vnd.dece-zip`
|
||||
- `application/vnd.dvb_service`
|
||||
- `application/vnd.micrografx-igx`
|
||||
- `application/vnd.sealed-doc`
|
||||
- `application/vnd.sealed-eml`
|
||||
- `application/vnd.sealed-mht`
|
||||
- `application/vnd.sealed-ppt`
|
||||
- `application/vnd.sealed-tiff`
|
||||
- `application/vnd.sealed-xls`
|
||||
- `application/vnd.sealedmedia.softseal-html`
|
||||
- `application/vnd.sealedmedia.softseal-pdf`
|
||||
- `application/vnd.wap-slc`
|
||||
- `application/vnd.wap-wbxml`
|
||||
- `audio/vnd.sealedmedia.softseal-mpeg`
|
||||
- `image/vnd-djvu`
|
||||
- `image/vnd-svf`
|
||||
- `image/vnd-wap-wbmp`
|
||||
- `image/vnd.sealed-png`
|
||||
- `image/vnd.sealedmedia.softseal-gif`
|
||||
- `image/vnd.sealedmedia.softseal-jpg`
|
||||
- `model/vnd-dwf`
|
||||
- `model/vnd.parasolid.transmit-binary`
|
||||
- `model/vnd.parasolid.transmit-text`
|
||||
- `text/vnd-a`
|
||||
- `text/vnd-curl`
|
||||
- `text/vnd.wap-wml`
|
||||
* Remove example template MIME types
|
||||
- `application/example`
|
||||
- `audio/example`
|
||||
- `image/example`
|
||||
- `message/example`
|
||||
- `model/example`
|
||||
- `multipart/example`
|
||||
- `text/example`
|
||||
- `video/example`
|
||||
|
||||
1.3.1 / 2014-12-16
|
||||
==================
|
||||
|
||||
* Fix missing extensions
|
||||
- `application/json5`
|
||||
- `text/hjson`
|
||||
|
||||
1.3.0 / 2014-12-07
|
||||
==================
|
||||
|
||||
* Add `application/a2l`
|
||||
* Add `application/aml`
|
||||
* Add `application/atfx`
|
||||
* Add `application/atxml`
|
||||
* Add `application/cdfx+xml`
|
||||
* Add `application/dii`
|
||||
* Add `application/json5`
|
||||
* Add `application/lxf`
|
||||
* Add `application/mf4`
|
||||
* Add `application/vnd.apache.thrift.compact`
|
||||
* Add `application/vnd.apache.thrift.json`
|
||||
* Add `application/vnd.coffeescript`
|
||||
* Add `application/vnd.enphase.envoy`
|
||||
* Add `application/vnd.ims.imsccv1p1`
|
||||
* Add `text/csv-schema`
|
||||
* Add `text/hjson`
|
||||
* Add `text/markdown`
|
||||
* Add `text/yaml`
|
||||
|
||||
1.2.0 / 2014-11-09
|
||||
==================
|
||||
|
||||
* Add `application/cea`
|
||||
* Add `application/dit`
|
||||
* Add `application/vnd.gov.sk.e-form+zip`
|
||||
* Add `application/vnd.tmd.mediaflex.api+xml`
|
||||
* Type `application/epub+zip` is now IANA-registered
|
||||
|
||||
1.1.2 / 2014-10-23
|
||||
==================
|
||||
|
||||
* Rebuild database for `application/x-www-form-urlencoded` change
|
||||
|
||||
1.1.1 / 2014-10-20
|
||||
==================
|
||||
|
||||
* Mark `application/x-www-form-urlencoded` as compressible.
|
||||
|
||||
1.1.0 / 2014-09-28
|
||||
==================
|
||||
|
||||
* Add `application/font-woff2`
|
||||
|
||||
1.0.3 / 2014-09-25
|
||||
==================
|
||||
|
||||
* Fix engine requirement in package
|
||||
|
||||
1.0.2 / 2014-09-25
|
||||
==================
|
||||
|
||||
* Add `application/coap-group+json`
|
||||
* Add `application/dcd`
|
||||
* Add `application/vnd.apache.thrift.binary`
|
||||
* Add `image/vnd.tencent.tap`
|
||||
* Mark all JSON-derived types as compressible
|
||||
* Update `text/vtt` data
|
||||
|
||||
1.0.1 / 2014-08-30
|
||||
==================
|
||||
|
||||
* Fix extension ordering
|
||||
|
||||
1.0.0 / 2014-08-30
|
||||
==================
|
||||
|
||||
* Add `application/atf`
|
||||
* Add `application/merge-patch+json`
|
||||
* Add `multipart/x-mixed-replace`
|
||||
* Add `source: 'apache'` metadata
|
||||
* Add `source: 'iana'` metadata
|
||||
* Remove badly-assumed charset data
|
22
node_modules/popsicle/node_modules/mime-db/LICENSE
generated
vendored
Normal file
22
node_modules/popsicle/node_modules/mime-db/LICENSE
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Jonathan Ong me@jongleberry.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
76
node_modules/popsicle/node_modules/mime-db/README.md
generated
vendored
Normal file
76
node_modules/popsicle/node_modules/mime-db/README.md
generated
vendored
Normal file
@ -0,0 +1,76 @@
|
||||
# mime-db
|
||||
|
||||
[![NPM Version][npm-version-image]][npm-url]
|
||||
[![NPM Downloads][npm-downloads-image]][npm-url]
|
||||
[![Node.js Version][node-image]][node-url]
|
||||
[![Build Status][travis-image]][travis-url]
|
||||
[![Coverage Status][coveralls-image]][coveralls-url]
|
||||
|
||||
This is a database of all mime types.
|
||||
It consists of a single, public JSON file and does not include any logic,
|
||||
allowing it to remain as un-opinionated as possible with an API.
|
||||
It aggregates data from the following sources:
|
||||
|
||||
- http://www.iana.org/assignments/media-types/media-types.xhtml
|
||||
- http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
npm install mime-db
|
||||
```
|
||||
|
||||
If you're crazy enough to use this in the browser,
|
||||
you can just grab the JSON file:
|
||||
|
||||
```
|
||||
https://cdn.rawgit.com/jshttp/mime-db/master/db.json
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var db = require('mime-db');
|
||||
|
||||
// grab data on .js files
|
||||
var data = db['application/javascript'];
|
||||
```
|
||||
|
||||
## Data Structure
|
||||
|
||||
The JSON file is a map lookup for lowercased mime types.
|
||||
Each mime type has the following properties:
|
||||
|
||||
- `.source` - where the mime type is defined.
|
||||
If not set, it's probably a custom media type.
|
||||
- `apache` - [Apache common media types](http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types)
|
||||
- `iana` - [IANA-defined media types](http://www.iana.org/assignments/media-types/media-types.xhtml)
|
||||
- `.extensions[]` - known extensions associated with this mime type.
|
||||
- `.compressible` - whether a file of this type is can be gzipped.
|
||||
- `.charset` - the default charset associated with this type, if any.
|
||||
|
||||
If unknown, every property could be `undefined`.
|
||||
|
||||
## Contributing
|
||||
|
||||
To edit the database, only make PRs against `src/custom.json` or
|
||||
`src/custom-suffix.json`.
|
||||
|
||||
To update the build, run `npm run update`.
|
||||
|
||||
## Adding Custom Media Types
|
||||
|
||||
The best way to get new media types included in this library is to register
|
||||
them with the IANA. The community registration procedure is outlined in
|
||||
[RFC 6838 section 5](http://tools.ietf.org/html/rfc6838#section-5). Types
|
||||
registered with the IANA are automatically pulled into this library.
|
||||
|
||||
[npm-version-image]: https://img.shields.io/npm/v/mime-db.svg
|
||||
[npm-downloads-image]: https://img.shields.io/npm/dm/mime-db.svg
|
||||
[npm-url]: https://npmjs.org/package/mime-db
|
||||
[travis-image]: https://img.shields.io/travis/jshttp/mime-db/master.svg
|
||||
[travis-url]: https://travis-ci.org/jshttp/mime-db
|
||||
[coveralls-image]: https://img.shields.io/coveralls/jshttp/mime-db/master.svg
|
||||
[coveralls-url]: https://coveralls.io/r/jshttp/mime-db?branch=master
|
||||
[node-image]: https://img.shields.io/node/v/mime-db.svg
|
||||
[node-url]: http://nodejs.org/download/
|
6359
node_modules/popsicle/node_modules/mime-db/db.json
generated
vendored
Normal file
6359
node_modules/popsicle/node_modules/mime-db/db.json
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
11
node_modules/popsicle/node_modules/mime-db/index.js
generated
vendored
Normal file
11
node_modules/popsicle/node_modules/mime-db/index.js
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
/*!
|
||||
* mime-db
|
||||
* Copyright(c) 2014 Jonathan Ong
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
*/
|
||||
|
||||
module.exports = require('./db.json')
|
119
node_modules/popsicle/node_modules/mime-db/package.json
generated
vendored
Normal file
119
node_modules/popsicle/node_modules/mime-db/package.json
generated
vendored
Normal file
@ -0,0 +1,119 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"mime-db@~1.12.0",
|
||||
"C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\popsicle\\node_modules\\mime-types"
|
||||
]
|
||||
],
|
||||
"_from": "mime-db@>=1.12.0-0 <1.13.0-0",
|
||||
"_id": "mime-db@1.12.0",
|
||||
"_inCache": true,
|
||||
"_location": "/popsicle/mime-db",
|
||||
"_npmUser": {
|
||||
"email": "doug@somethingdoug.com",
|
||||
"name": "dougwilson"
|
||||
},
|
||||
"_npmVersion": "1.4.28",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "mime-db",
|
||||
"raw": "mime-db@~1.12.0",
|
||||
"rawSpec": "~1.12.0",
|
||||
"scope": null,
|
||||
"spec": ">=1.12.0-0 <1.13.0-0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/popsicle/mime-types"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.12.0.tgz",
|
||||
"_shasum": "3d0c63180f458eb10d325aaa37d7c58ae312e9d7",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "mime-db@~1.12.0",
|
||||
"_where": "C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\popsicle\\node_modules\\mime-types",
|
||||
"bugs": {
|
||||
"url": "https://github.com/jshttp/mime-db/issues"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Douglas Christopher Wilson",
|
||||
"email": "doug@somethingdoug.com"
|
||||
},
|
||||
{
|
||||
"name": "Jonathan Ong",
|
||||
"email": "me@jongleberry.com",
|
||||
"url": "http://jongleberry.com"
|
||||
},
|
||||
{
|
||||
"name": "Robert Kieffer",
|
||||
"email": "robert@broofa.com",
|
||||
"url": "http://github.com/broofa"
|
||||
}
|
||||
],
|
||||
"dependencies": {},
|
||||
"description": "Media Type Database",
|
||||
"devDependencies": {
|
||||
"bluebird": "2.9.27",
|
||||
"co": "4.5.4",
|
||||
"cogent": "1.0.1",
|
||||
"csv-parse": "0.1.2",
|
||||
"gnode": "0.1.1",
|
||||
"istanbul": "0.3.9",
|
||||
"mocha": "1.21.5",
|
||||
"raw-body": "2.1.0",
|
||||
"stream-to-array": "2"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "3d0c63180f458eb10d325aaa37d7c58ae312e9d7",
|
||||
"tarball": "https://registry.npmjs.org/mime-db/-/mime-db-1.12.0.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
},
|
||||
"files": [
|
||||
"HISTORY.md",
|
||||
"LICENSE",
|
||||
"README.md",
|
||||
"db.json",
|
||||
"index.js"
|
||||
],
|
||||
"gitHead": "cf35cbba6b22f4a3b3eef9a32129ea5b7f0f91ee",
|
||||
"homepage": "https://github.com/jshttp/mime-db",
|
||||
"installable": true,
|
||||
"keywords": [
|
||||
"charset",
|
||||
"charsets",
|
||||
"database",
|
||||
"db",
|
||||
"mime",
|
||||
"type",
|
||||
"types"
|
||||
],
|
||||
"license": "MIT",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "jongleberry",
|
||||
"email": "jonathanrichardong@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "dougwilson",
|
||||
"email": "doug@somethingdoug.com"
|
||||
}
|
||||
],
|
||||
"name": "mime-db",
|
||||
"optionalDependencies": {},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/jshttp/mime-db"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "node scripts/build",
|
||||
"fetch": "gnode scripts/extensions && gnode scripts/types",
|
||||
"test": "mocha --reporter spec --bail --check-leaks test/",
|
||||
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/",
|
||||
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/",
|
||||
"update": "npm run fetch && npm run build"
|
||||
},
|
||||
"version": "1.12.0"
|
||||
}
|
115
node_modules/popsicle/node_modules/mime-types/HISTORY.md
generated
vendored
Normal file
115
node_modules/popsicle/node_modules/mime-types/HISTORY.md
generated
vendored
Normal file
@ -0,0 +1,115 @@
|
||||
2.0.14 / 2015-06-06
|
||||
===================
|
||||
|
||||
* deps: mime-db@~1.12.0
|
||||
- Add new mime types
|
||||
|
||||
2.0.13 / 2015-05-31
|
||||
===================
|
||||
|
||||
* deps: mime-db@~1.11.0
|
||||
- Add new mime types
|
||||
|
||||
2.0.12 / 2015-05-19
|
||||
===================
|
||||
|
||||
* deps: mime-db@~1.10.0
|
||||
- Add new mime types
|
||||
|
||||
2.0.11 / 2015-05-05
|
||||
===================
|
||||
|
||||
* deps: mime-db@~1.9.1
|
||||
- Add new mime types
|
||||
|
||||
2.0.10 / 2015-03-13
|
||||
===================
|
||||
|
||||
* deps: mime-db@~1.8.0
|
||||
- Add new mime types
|
||||
|
||||
2.0.9 / 2015-02-09
|
||||
==================
|
||||
|
||||
* deps: mime-db@~1.7.0
|
||||
- Add new mime types
|
||||
- Community extensions ownership transferred from `node-mime`
|
||||
|
||||
2.0.8 / 2015-01-29
|
||||
==================
|
||||
|
||||
* deps: mime-db@~1.6.0
|
||||
- Add new mime types
|
||||
|
||||
2.0.7 / 2014-12-30
|
||||
==================
|
||||
|
||||
* deps: mime-db@~1.5.0
|
||||
- Add new mime types
|
||||
- Fix various invalid MIME type entries
|
||||
|
||||
2.0.6 / 2014-12-30
|
||||
==================
|
||||
|
||||
* deps: mime-db@~1.4.0
|
||||
- Add new mime types
|
||||
- Fix various invalid MIME type entries
|
||||
- Remove example template MIME types
|
||||
|
||||
2.0.5 / 2014-12-29
|
||||
==================
|
||||
|
||||
* deps: mime-db@~1.3.1
|
||||
- Fix missing extensions
|
||||
|
||||
2.0.4 / 2014-12-10
|
||||
==================
|
||||
|
||||
* deps: mime-db@~1.3.0
|
||||
- Add new mime types
|
||||
|
||||
2.0.3 / 2014-11-09
|
||||
==================
|
||||
|
||||
* deps: mime-db@~1.2.0
|
||||
- Add new mime types
|
||||
|
||||
2.0.2 / 2014-09-28
|
||||
==================
|
||||
|
||||
* deps: mime-db@~1.1.0
|
||||
- Add new mime types
|
||||
- Add additional compressible
|
||||
- Update charsets
|
||||
|
||||
2.0.1 / 2014-09-07
|
||||
==================
|
||||
|
||||
* Support Node.js 0.6
|
||||
|
||||
2.0.0 / 2014-09-02
|
||||
==================
|
||||
|
||||
* Use `mime-db`
|
||||
* Remove `.define()`
|
||||
|
||||
1.0.2 / 2014-08-04
|
||||
==================
|
||||
|
||||
* Set charset=utf-8 for `text/javascript`
|
||||
|
||||
1.0.1 / 2014-06-24
|
||||
==================
|
||||
|
||||
* Add `text/jsx` type
|
||||
|
||||
1.0.0 / 2014-05-12
|
||||
==================
|
||||
|
||||
* Return `false` for unknown types
|
||||
* Set charset=utf-8 for `application/json`
|
||||
|
||||
0.1.0 / 2014-05-02
|
||||
==================
|
||||
|
||||
* Initial release
|
22
node_modules/popsicle/node_modules/mime-types/LICENSE
generated
vendored
Normal file
22
node_modules/popsicle/node_modules/mime-types/LICENSE
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Jonathan Ong me@jongleberry.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
102
node_modules/popsicle/node_modules/mime-types/README.md
generated
vendored
Normal file
102
node_modules/popsicle/node_modules/mime-types/README.md
generated
vendored
Normal file
@ -0,0 +1,102 @@
|
||||
# mime-types
|
||||
|
||||
[![NPM Version][npm-image]][npm-url]
|
||||
[![NPM Downloads][downloads-image]][downloads-url]
|
||||
[![Node.js Version][node-version-image]][node-version-url]
|
||||
[![Build Status][travis-image]][travis-url]
|
||||
[![Test Coverage][coveralls-image]][coveralls-url]
|
||||
|
||||
The ultimate javascript content-type utility.
|
||||
|
||||
Similar to [node-mime](https://github.com/broofa/node-mime), except:
|
||||
|
||||
- __No fallbacks.__ Instead of naively returning the first available type, `mime-types` simply returns `false`,
|
||||
so do `var type = mime.lookup('unrecognized') || 'application/octet-stream'`.
|
||||
- No `new Mime()` business, so you could do `var lookup = require('mime-types').lookup`.
|
||||
- Additional mime types are added such as jade and stylus via [mime-db](https://github.com/jshttp/mime-db)
|
||||
- No `.define()` functionality
|
||||
|
||||
Otherwise, the API is compatible.
|
||||
|
||||
## Install
|
||||
|
||||
```sh
|
||||
$ npm install mime-types
|
||||
```
|
||||
|
||||
## Adding Types
|
||||
|
||||
All mime types are based on [mime-db](https://github.com/jshttp/mime-db),
|
||||
so open a PR there if you'd like to add mime types.
|
||||
|
||||
## API
|
||||
|
||||
```js
|
||||
var mime = require('mime-types')
|
||||
```
|
||||
|
||||
All functions return `false` if input is invalid or not found.
|
||||
|
||||
### mime.lookup(path)
|
||||
|
||||
Lookup the content-type associated with a file.
|
||||
|
||||
```js
|
||||
mime.lookup('json') // 'application/json'
|
||||
mime.lookup('.md') // 'text/x-markdown'
|
||||
mime.lookup('file.html') // 'text/html'
|
||||
mime.lookup('folder/file.js') // 'application/javascript'
|
||||
|
||||
mime.lookup('cats') // false
|
||||
```
|
||||
|
||||
### mime.contentType(type)
|
||||
|
||||
Create a full content-type header given a content-type or extension.
|
||||
|
||||
```js
|
||||
mime.contentType('markdown') // 'text/x-markdown; charset=utf-8'
|
||||
mime.contentType('file.json') // 'application/json; charset=utf-8'
|
||||
|
||||
// from a full path
|
||||
mime.contentType(path.extname('/path/to/file.json')) // 'application/json; charset=utf-8'
|
||||
```
|
||||
|
||||
### mime.extension(type)
|
||||
|
||||
Get the default extension for a content-type.
|
||||
|
||||
```js
|
||||
mime.extension('application/octet-stream') // 'bin'
|
||||
```
|
||||
|
||||
### mime.charset(type)
|
||||
|
||||
Lookup the implied default charset of a content-type.
|
||||
|
||||
```js
|
||||
mime.charset('text/x-markdown') // 'UTF-8'
|
||||
```
|
||||
|
||||
### var type = mime.types[extension]
|
||||
|
||||
A map of content-types by extension.
|
||||
|
||||
### [extensions...] = mime.extensions[type]
|
||||
|
||||
A map of extensions by content-type.
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
||||
|
||||
[npm-image]: https://img.shields.io/npm/v/mime-types.svg
|
||||
[npm-url]: https://npmjs.org/package/mime-types
|
||||
[node-version-image]: https://img.shields.io/node/v/mime-types.svg
|
||||
[node-version-url]: http://nodejs.org/download/
|
||||
[travis-image]: https://img.shields.io/travis/jshttp/mime-types/master.svg
|
||||
[travis-url]: https://travis-ci.org/jshttp/mime-types
|
||||
[coveralls-image]: https://img.shields.io/coveralls/jshttp/mime-types/master.svg
|
||||
[coveralls-url]: https://coveralls.io/r/jshttp/mime-types
|
||||
[downloads-image]: https://img.shields.io/npm/dm/mime-types.svg
|
||||
[downloads-url]: https://npmjs.org/package/mime-types
|
63
node_modules/popsicle/node_modules/mime-types/index.js
generated
vendored
Normal file
63
node_modules/popsicle/node_modules/mime-types/index.js
generated
vendored
Normal file
@ -0,0 +1,63 @@
|
||||
|
||||
var db = require('mime-db')
|
||||
|
||||
// types[extension] = type
|
||||
exports.types = Object.create(null)
|
||||
// extensions[type] = [extensions]
|
||||
exports.extensions = Object.create(null)
|
||||
|
||||
Object.keys(db).forEach(function (name) {
|
||||
var mime = db[name]
|
||||
var exts = mime.extensions
|
||||
if (!exts || !exts.length) return
|
||||
exports.extensions[name] = exts
|
||||
exts.forEach(function (ext) {
|
||||
exports.types[ext] = name
|
||||
})
|
||||
})
|
||||
|
||||
exports.lookup = function (string) {
|
||||
if (!string || typeof string !== "string") return false
|
||||
// remove any leading paths, though we should just use path.basename
|
||||
string = string.replace(/.*[\.\/\\]/, '').toLowerCase()
|
||||
if (!string) return false
|
||||
return exports.types[string] || false
|
||||
}
|
||||
|
||||
exports.extension = function (type) {
|
||||
if (!type || typeof type !== "string") return false
|
||||
// to do: use media-typer
|
||||
type = type.match(/^\s*([^;\s]*)(?:;|\s|$)/)
|
||||
if (!type) return false
|
||||
var exts = exports.extensions[type[1].toLowerCase()]
|
||||
if (!exts || !exts.length) return false
|
||||
return exts[0]
|
||||
}
|
||||
|
||||
// type has to be an exact mime type
|
||||
exports.charset = function (type) {
|
||||
var mime = db[type]
|
||||
if (mime && mime.charset) return mime.charset
|
||||
|
||||
// default text/* to utf-8
|
||||
if (/^text\//.test(type)) return 'UTF-8'
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
// backwards compatibility
|
||||
exports.charsets = {
|
||||
lookup: exports.charset
|
||||
}
|
||||
|
||||
// to do: maybe use set-type module or something
|
||||
exports.contentType = function (type) {
|
||||
if (!type || typeof type !== "string") return false
|
||||
if (!~type.indexOf('/')) type = exports.lookup(type)
|
||||
if (!type) return false
|
||||
if (!~type.indexOf('charset')) {
|
||||
var charset = exports.charset(type)
|
||||
if (charset) type += '; charset=' + charset.toLowerCase()
|
||||
}
|
||||
return type
|
||||
}
|
108
node_modules/popsicle/node_modules/mime-types/package.json
generated
vendored
Normal file
108
node_modules/popsicle/node_modules/mime-types/package.json
generated
vendored
Normal file
@ -0,0 +1,108 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"mime-types@~2.0.3",
|
||||
"C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\popsicle\\node_modules\\form-data"
|
||||
]
|
||||
],
|
||||
"_from": "mime-types@>=2.0.3-0 <2.1.0-0",
|
||||
"_id": "mime-types@2.0.14",
|
||||
"_inCache": true,
|
||||
"_location": "/popsicle/mime-types",
|
||||
"_npmUser": {
|
||||
"email": "doug@somethingdoug.com",
|
||||
"name": "dougwilson"
|
||||
},
|
||||
"_npmVersion": "1.4.28",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "mime-types",
|
||||
"raw": "mime-types@~2.0.3",
|
||||
"rawSpec": "~2.0.3",
|
||||
"scope": null,
|
||||
"spec": ">=2.0.3-0 <2.1.0-0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/popsicle/form-data"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.0.14.tgz",
|
||||
"_shasum": "310e159db23e077f8bb22b748dabfa4957140aa6",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "mime-types@~2.0.3",
|
||||
"_where": "C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\popsicle\\node_modules\\form-data",
|
||||
"bugs": {
|
||||
"url": "https://github.com/jshttp/mime-types/issues"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Douglas Christopher Wilson",
|
||||
"email": "doug@somethingdoug.com"
|
||||
},
|
||||
{
|
||||
"name": "Jeremiah Senkpiel",
|
||||
"email": "fishrock123@rocketmail.com",
|
||||
"url": "https://searchbeam.jit.su"
|
||||
},
|
||||
{
|
||||
"name": "Jonathan Ong",
|
||||
"email": "me@jongleberry.com",
|
||||
"url": "http://jongleberry.com"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"mime-db": "~1.12.0"
|
||||
},
|
||||
"description": "The ultimate javascript content-type utility.",
|
||||
"devDependencies": {
|
||||
"istanbul": "0.3.9",
|
||||
"mocha": "~1.21.5"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "310e159db23e077f8bb22b748dabfa4957140aa6",
|
||||
"tarball": "https://registry.npmjs.org/mime-types/-/mime-types-2.0.14.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
},
|
||||
"files": [
|
||||
"HISTORY.md",
|
||||
"LICENSE",
|
||||
"index.js"
|
||||
],
|
||||
"gitHead": "7d53a3351581eb3d7ae1e846ea860037bce6fe3f",
|
||||
"homepage": "https://github.com/jshttp/mime-types",
|
||||
"installable": true,
|
||||
"keywords": [
|
||||
"mime",
|
||||
"types"
|
||||
],
|
||||
"license": "MIT",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "jongleberry",
|
||||
"email": "jonathanrichardong@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "fishrock123",
|
||||
"email": "fishrock123@rocketmail.com"
|
||||
},
|
||||
{
|
||||
"name": "dougwilson",
|
||||
"email": "doug@somethingdoug.com"
|
||||
}
|
||||
],
|
||||
"name": "mime-types",
|
||||
"optionalDependencies": {},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/jshttp/mime-types"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha --reporter spec test/test.js",
|
||||
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot test/test.js",
|
||||
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter dot test/test.js"
|
||||
},
|
||||
"version": "2.0.14"
|
||||
}
|
129
node_modules/popsicle/package.json
generated
vendored
Normal file
129
node_modules/popsicle/package.json
generated
vendored
Normal file
@ -0,0 +1,129 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"popsicle@^5.0.0",
|
||||
"C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\typings-core"
|
||||
]
|
||||
],
|
||||
"_from": "popsicle@>=5.0.0-0 <6.0.0-0",
|
||||
"_id": "popsicle@5.0.1",
|
||||
"_inCache": true,
|
||||
"_location": "/popsicle",
|
||||
"_nodeVersion": "5.7.1",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-12-west.internal.npmjs.com",
|
||||
"tmp": "tmp/popsicle-5.0.1.tgz_1459375255507_0.8800357119180262"
|
||||
},
|
||||
"_npmUser": {
|
||||
"email": "hello@blakeembrey.com",
|
||||
"name": "blakeembrey"
|
||||
},
|
||||
"_npmVersion": "3.6.0",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "popsicle",
|
||||
"raw": "popsicle@^5.0.0",
|
||||
"rawSpec": "^5.0.0",
|
||||
"scope": null,
|
||||
"spec": ">=5.0.0-0 <6.0.0-0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/typings-core"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/popsicle/-/popsicle-5.0.1.tgz",
|
||||
"_shasum": "95606d99fe5c12c3c59aaaea2a2a26c2c501cac6",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "popsicle@^5.0.0",
|
||||
"_where": "C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\typings-core",
|
||||
"author": {
|
||||
"email": "hello@blakeembrey.com",
|
||||
"name": "Blake Embrey",
|
||||
"url": "http://blakeembrey.me"
|
||||
},
|
||||
"browser": {
|
||||
"./dist/index.js": "./dist/browser.js",
|
||||
"./dist/plugins/index.js": "./dist/plugins/browser.js",
|
||||
"buffer": false,
|
||||
"form-data": "./dist/browser/form-data.js",
|
||||
"tough-cookie": "./dist/browser/tough-cookie.js"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/blakeembrey/popsicle/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"any-promise": "^1.0.0",
|
||||
"arrify": "^1.0.0",
|
||||
"concat-stream": "^1.4.7",
|
||||
"form-data": "^0.2.0",
|
||||
"make-error-cause": "^1.0.1",
|
||||
"methods": "^1.1.1",
|
||||
"tough-cookie": "^2.0.0",
|
||||
"xtend": "^4.0.0"
|
||||
},
|
||||
"description": "Simple HTTP requests for node and the browser",
|
||||
"devDependencies": {
|
||||
"blue-tape": "^0.2.0",
|
||||
"bluebird": "^3.0.5",
|
||||
"body-parser": "^1.9.2",
|
||||
"browserify": "^13.0.0",
|
||||
"envify": "^3.4.0",
|
||||
"express": "^4.10.2",
|
||||
"istanbul": "^0.4.0",
|
||||
"pre-commit": "^1.0.10",
|
||||
"tap-spec": "^4.1.1",
|
||||
"tape-run": "2.1.0",
|
||||
"typescript": "^1.7.3",
|
||||
"typings": "^0.6.7"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "95606d99fe5c12c3c59aaaea2a2a26c2c501cac6",
|
||||
"tarball": "https://registry.npmjs.org/popsicle/-/popsicle-5.0.1.tgz"
|
||||
},
|
||||
"files": [
|
||||
"LICENSE",
|
||||
"dist/",
|
||||
"logo.svg",
|
||||
"typings.json"
|
||||
],
|
||||
"gitHead": "e99b956cecaa7853e949cac2fd0f21096fb6f4d9",
|
||||
"homepage": "https://github.com/blakeembrey/popsicle",
|
||||
"installable": true,
|
||||
"keywords": [
|
||||
"agent",
|
||||
"ajax",
|
||||
"browser",
|
||||
"http",
|
||||
"node",
|
||||
"promise",
|
||||
"request"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "dist/common.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "blakeembrey",
|
||||
"email": "hello@blakeembrey.com"
|
||||
}
|
||||
],
|
||||
"name": "popsicle",
|
||||
"optionalDependencies": {},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/blakeembrey/popsicle.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "rm -rf dist/ && tsc && npm run check-size",
|
||||
"check-size": "browserify . -s popsicle --external bluebird > popsicle.js && du -h popsicle.js",
|
||||
"lint": "# TODO",
|
||||
"prepublish": "typings install && npm run build",
|
||||
"test": "npm run lint && npm run build && npm run test-server-open && npm run test-cov && npm run test-browser; EXIT=$?; npm run test-server-close; exit $EXIT",
|
||||
"test-browser": "HTTPS_PORT=7358 PORT=7357 browserify -d -t envify dist/test/index.js | tape-run --render tap-spec",
|
||||
"test-cov": "HTTPS_PORT=7358 PORT=7357 istanbul cover --print none dist/test/index.js | tap-spec",
|
||||
"test-server-close": "if [ -f server.pid ]; then kill -9 $(cat server.pid); rm server.pid; fi; if [ -f https-server.pid ]; then kill -9 $(cat https-server.pid); rm https-server.pid; fi",
|
||||
"test-server-open": "PORT=7357 node scripts/server.js & echo $! > server.pid; HTTPS_PORT=7358 node scripts/https-server.js & echo $! > https-server.pid",
|
||||
"test-spec": "npm run test-server-open && HTTPS_PORT=7358 PORT=7357 node dist/test/index.js | tap-spec; EXIT=$?; npm run test-server-close; exit $EXIT"
|
||||
},
|
||||
"version": "5.0.1"
|
||||
}
|
18
node_modules/popsicle/typings.json
generated
vendored
Normal file
18
node_modules/popsicle/typings.json
generated
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
{
|
||||
"devDependencies": {
|
||||
"blue-tape": "github:typings/typed-blue-tape#a4e41a85d6f760e7c60088127968eae7d3a556fa"
|
||||
},
|
||||
"ambientDependencies": {
|
||||
"node": "github:DefinitelyTyped/DefinitelyTyped/node/node.d.ts#8cf8164641be73e8f1e652c2a5b967c7210b6729"
|
||||
},
|
||||
"dependencies": {
|
||||
"any-promise": "github:typings/typed-any-promise#74ba6cf22149ff4de39c2338a9cb84f9ded6f042",
|
||||
"arrify": "github:typings/typed-arrify#32383d5fd3e6a8614abb6dba254a3aab07cd7424",
|
||||
"concat-stream": "github:typings/typed-concat-stream#099a88b57dcc9968246e8b1b3651e914a1a2c324",
|
||||
"form-data": "github:typings/typed-form-data#edc32200ec6065d98bfaa7ff9cfd104e17c5d3e4",
|
||||
"make-error-cause": "npm:make-error-cause",
|
||||
"methods": "github:typings/typed-methods#b902fa13683e95d54b2bb69188f68ea3525ec430",
|
||||
"tough-cookie": "github:typings/typed-tough-cookie#3e37dc2e6d448130d2fa4be1026e195ffda2b398",
|
||||
"xtend": "github:typings/typed-xtend#63cccadf3295b3c15561ee45617ac006edcca9e0"
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user