Comparing version 3.0.0 to 3.0.1
@@ -8,4 +8,4 @@ import Request, { RequestOptions, DefaultsOptions } from './request'; | ||
export declare function defaults(defaultsOptions: DefaultsOptions): (options: RequestOptions | string) => Request; | ||
declare const browser: boolean; | ||
declare const popsicle: (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; | ||
@@ -17,3 +17,3 @@ export declare const post: (options: RequestOptions | string) => Request; | ||
export declare const head: (options: RequestOptions | string) => Request; | ||
export { Request, Response, plugins, form, jar, browser, transport }; | ||
export default popsicle; | ||
export { Request, Response, plugins, form, jar, transport }; | ||
export default request; |
@@ -31,5 +31,4 @@ var extend = require('xtend'); | ||
exports.defaults = defaults; | ||
var browser = !!process.browser; | ||
exports.browser = browser; | ||
var popsicle = defaults({}); | ||
exports.browser = !!process.browser; | ||
exports.request = defaults({}); | ||
exports.get = defaults({ method: 'get' }); | ||
@@ -42,3 +41,3 @@ exports.post = defaults({ method: 'post' }); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.default = popsicle; | ||
exports.default = exports.request; | ||
//# sourceMappingURL=common.js.map |
@@ -30,3 +30,3 @@ function __export(m) { | ||
function concatStream(encoding) { | ||
return function concatStream(request) { | ||
return function (request) { | ||
request.after(function (response) { | ||
@@ -33,0 +33,0 @@ return new Promise(function (resolve, reject) { |
{ | ||
"name": "popsicle", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "Simple HTTP requests for node and the browser", | ||
@@ -5,0 +5,0 @@ "main": "dist/common.js", |
@@ -31,3 +31,3 @@ # ![Popsicle](https://cdn.rawgit.com/blakeembrey/popsicle/master/logo.svg) | ||
popsicle.default({ | ||
popsicle.request({ | ||
method: 'POST', | ||
@@ -50,4 +50,21 @@ url: 'http://example.com/api/users', | ||
**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'`. | ||
**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 | ||
@@ -86,3 +103,3 @@ | ||
Common methods have a short hand exported (created using `defaults({ method: 'get' })`). | ||
Common methods have a short hand exported (created using `defaults({ method })`). | ||
@@ -191,12 +208,10 @@ ```js | ||
parse: [Function: parse], | ||
cookieJar: [Function: cookieJar], | ||
unzip: [Function: unzip], | ||
concatStream: [Function: concatStream], | ||
defaults: [ | ||
[Function: stringify], | ||
[Function: headers], | ||
[Function: cookieJar], | ||
[Function: unzip], | ||
[Function: concatStream], | ||
[Function: parse] | ||
[Function], | ||
[Function], | ||
[Function], | ||
[Function], | ||
[Function] | ||
] | ||
@@ -211,3 +226,2 @@ } | ||
* **concatStream** Buffer the whole stream using [concat-stream](https://www.npmjs.com/package/concat-stream) - accepts an "encoding" type (`string` (default), `buffer`, `array`, `uint8array`, `object`) (Node only) | ||
* **cookieJar** Support the cookie jar option in node (Recommended, Node only) | ||
@@ -221,4 +235,4 @@ #### Cookie Jar (Node only) | ||
popsicle.default({ | ||
method: 'POST', | ||
popsicle.request({ | ||
method: 'post', | ||
url: '/users', | ||
@@ -328,3 +342,3 @@ options: { | ||
popsicle.default('/user') | ||
popsicle.request('/user') | ||
.use(prefix('http://example.com')) | ||
@@ -331,0 +345,0 @@ .then(function (response) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
161823
393
2
2012