superagent
Advanced tools
Comparing version 3.5.3-beta.2 to 3.6.0
# SuperAgent | ||
SuperAgent is light-weight progressive ajax API crafted for flexibility, readability, and a low learning curve after being frustrated with many of the existing request APIs. It also works with Node.js! | ||
SuperAgent is light-weight progressive ajax API crafted for flexibility, readability, and a low learning curve after being frustrated with many of the existing request APIs. It also works with Node.js! | ||
@@ -21,7 +21,7 @@ request | ||
The following [test documentation](docs/test.html) was generated with [Mocha's](http://mochajs.org/) "doc" reporter, and directly reflects the test suite. This provides an additional source of documentation. | ||
The following [test documentation](docs/test.html) was generated with [Mocha's](http://mochajs.org/) "doc" reporter, and directly reflects the test suite. This provides an additional source of documentation. | ||
## Request basics | ||
A request can be initiated by invoking the appropriate method on the `request` object, then calling `.end()` to send the request. For example a simple __GET__ request: | ||
A request can be initiated by invoking the appropriate method on the `request` object, then calling `.end()` to send the request. For example a simple __GET__ request: | ||
@@ -34,3 +34,3 @@ request | ||
A method string may also be passed: | ||
A method string may also be passed: | ||
@@ -43,3 +43,3 @@ request('GET', '/search').end(callback); | ||
The __Node__ client may also provide absolute URLs. In browsers absolute URLs won't work unless the server implements [CORS](#cors). | ||
The __Node__ client may also provide absolute URLs. In browsers absolute URLs won't work unless the server implements [CORS](#cors). | ||
@@ -52,3 +52,3 @@ request | ||
The __Node__ client supports making requests to [Unix Domain Sockets](http://en.wikipedia.org/wiki/Unix_domain_socket): | ||
The __Node__ client supports making requests to [Unix Domain Sockets](http://en.wikipedia.org/wiki/Unix_domain_socket): | ||
@@ -63,3 +63,3 @@ // pattern: https?+unix://SOCKET_PATH/REQUEST_PATH | ||
__DELETE__, __HEAD__, __PATCH__, __POST__, and __PUT__ requests can also be used, simply change the method name: | ||
__DELETE__, __HEAD__, __PATCH__, __POST__, and __PUT__ requests can also be used, simply change the method name: | ||
@@ -72,3 +72,3 @@ request | ||
__DELETE__ can be also called as `.del()` for compatibility with old IE where `delete` is a reserved word. | ||
__DELETE__ can be also called as `.del()` for compatibility with old IE where `delete` is a reserved word. | ||
@@ -83,3 +83,3 @@ The HTTP method defaults to __GET__, so if you wish, the following is valid: | ||
Setting header fields is simple, invoke `.set()` with a field name and value: | ||
Setting header fields is simple, invoke `.set()` with a field name and value: | ||
@@ -92,3 +92,3 @@ request | ||
You may also pass an object to set several fields in a single call: | ||
You may also pass an object to set several fields in a single call: | ||
@@ -102,3 +102,3 @@ request | ||
The `.query()` method accepts objects, which when used with the __GET__ method will form a query-string. The following will produce the path `/search?query=Manny&range=1..5&order=desc`. | ||
The `.query()` method accepts objects, which when used with the __GET__ method will form a query-string. The following will produce the path `/search?query=Manny&range=1..5&order=desc`. | ||
@@ -114,3 +114,3 @@ request | ||
Or as a single object: | ||
Or as a single object: | ||
@@ -124,3 +124,3 @@ request | ||
The `.query()` method accepts strings as well: | ||
The `.query()` method accepts strings as well: | ||
@@ -134,3 +134,3 @@ request | ||
Or joined: | ||
Or joined: | ||
@@ -158,3 +158,3 @@ request | ||
A typical JSON __POST__ request might look a little like the following, where we set the Content-Type header field appropriately, and "write" some data, in this case just a JSON string. | ||
A typical JSON __POST__ request might look a little like the following, where we set the Content-Type header field appropriately, and "write" some data, in this case just a JSON string. | ||
@@ -166,3 +166,3 @@ request.post('/user') | ||
Since JSON is undoubtably the most common, it's the _default_! The following example is equivalent to the previous. | ||
Since JSON is undoubtedly the most common, it's the _default_! The following example is equivalent to the previous. | ||
@@ -173,3 +173,3 @@ request.post('/user') | ||
Or using multiple `.send()` calls: | ||
Or using multiple `.send()` calls: | ||
@@ -181,3 +181,3 @@ request.post('/user') | ||
By default sending strings will set the `Content-Type` to `application/x-www-form-urlencoded`, | ||
By default sending strings will set the `Content-Type` to `application/x-www-form-urlencoded`, | ||
multiple calls will be concatenated with `&`, here resulting in `name=tj&pet=tobi`: | ||
@@ -190,3 +190,3 @@ | ||
SuperAgent formats are extensible, however by default "json" and "form" are supported. To send the data as `application/x-www-form-urlencoded` simply invoke `.type()` with "form", where the default is "json". This request will __POST__ the body "name=tj&pet=tobi". | ||
SuperAgent formats are extensible, however by default "json" and "form" are supported. To send the data as `application/x-www-form-urlencoded` simply invoke `.type()` with "form", where the default is "json". This request will __POST__ the body "name=tj&pet=tobi". | ||
@@ -198,6 +198,12 @@ request.post('/user') | ||
.end(callback) | ||
Sending a [`FormData`](https://developer.mozilla.org/en-US/docs/Web/API/FormData/FormData) object is also supported. The following example will __POST__ the content of the HTML form identified by id="myForm": | ||
request.post('/user') | ||
.send(new FormData(document.getElementById('myForm'))) | ||
.end(callback) | ||
## Setting the `Content-Type` | ||
The obvious solution is to use the `.set()` method: | ||
The obvious solution is to use the `.set()` method: | ||
@@ -207,5 +213,5 @@ request.post('/user') | ||
As a short-hand the `.type()` method is also available, accepting | ||
the canonicalized MIME type name complete with type/subtype, or | ||
simply the extension name such as "xml", "json", "png", etc: | ||
As a short-hand the `.type()` method is also available, accepting | ||
the canonicalized MIME type name complete with type/subtype, or | ||
simply the extension name such as "xml", "json", "png", etc: | ||
@@ -253,3 +259,3 @@ request.post('/user') | ||
`res.query(obj)` is a method which may be used to build up a query-string. For example populating `?format=json&dest=/login` on a __POST__: | ||
`req.query(obj)` is a method which may be used to build up a query-string. For example populating `?format=json&dest=/login` on a __POST__: | ||
@@ -263,3 +269,3 @@ request | ||
By default the query string is not assembled in any particular order. An asciibetically-sorted query string can be enabled with `req.sortQuery()`. You may also provide a custom sorting comparison function with `req.sortQuery(myComparisonFn)`. The comparison function should take 2 arguments and return a negative/zero/positive integer. | ||
By default the query string is not assembled in any particular order. An asciibetically-sorted query string can be enabled with `req.sortQuery()`. You may also provide a custom sorting comparison function with `req.sortQuery(myComparisonFn)`. The comparison function should take 2 arguments and return a negative/zero/positive integer. | ||
@@ -317,15 +323,15 @@ ```js | ||
SuperAgent will parse known response-body data for you, currently supporting `application/x-www-form-urlencoded`, `application/json`, and `multipart/form-data`. | ||
SuperAgent will parse known response-body data for you, currently supporting `application/x-www-form-urlencoded`, `application/json`, and `multipart/form-data`. | ||
You can set a custom parser (that takes precedence over built-in parsers) with the `.buffer(true).parse(fn)` method. If response buffering is not enabled (`.buffer(false)`) then the `response` event will be emitted without waiting for the body parser to finish, so `response.body` won't be available. | ||
You can set a custom parser (that takes precedence over built-in parsers) with the `.buffer(true).parse(fn)` method. If response buffering is not enabled (`.buffer(false)`) then the `response` event will be emitted without waiting for the body parser to finish, so `response.body` won't be available. | ||
### JSON / Urlencoded | ||
The property `res.body` is the parsed object, for example if a request responded with the JSON string '{"user":{"name":"tobi"}}', `res.body.user.name` would be "tobi". Likewise the x-www-form-urlencoded value of "user[name]=tobi" would yield the same result. Only one level of nesting is supported. If you need more complex data, send JSON instead. | ||
The property `res.body` is the parsed object, for example if a request responded with the JSON string '{"user":{"name":"tobi"}}', `res.body.user.name` would be "tobi". Likewise the x-www-form-urlencoded value of "user[name]=tobi" would yield the same result. Only one level of nesting is supported. If you need more complex data, send JSON instead. | ||
Arrays are sent by repeating the key. `.send({color: ['red','blue']})` sends `color=red&color=blue`. If you want the array keys to contain `[]` in their name, you must add it yourself, as SuperAgent doesn't add it automatically. | ||
Arrays are sent by repeating the key. `.send({color: ['red','blue']})` sends `color=red&color=blue`. If you want the array keys to contain `[]` in their name, you must add it yourself, as SuperAgent doesn't add it automatically. | ||
### Multipart | ||
The Node client supports _multipart/form-data_ via the [Formidable](https://github.com/felixge/node-formidable) module. When parsing multipart responses, the object `res.files` is also available to you. Suppose for example a request responds with the following multipart body: | ||
The Node client supports _multipart/form-data_ via the [Formidable](https://github.com/felixge/node-formidable) module. When parsing multipart responses, the object `res.files` is also available to you. Suppose for example a request responds with the following multipart body: | ||
@@ -344,3 +350,3 @@ --whoop | ||
You would have the values `res.body.name` provided as "Tobi", and `res.files.image` as a `File` object containing the path on disk, filename, and other properties. | ||
You would have the values `res.body.name` provided as "Tobi", and `res.files.image` as a `File` object containing the path on disk, filename, and other properties. | ||
@@ -366,28 +372,23 @@ ### Binary | ||
Many helpful flags and properties are set on the `Response` object, ranging from the response text, parsed response body, header fields, status flags and more. | ||
Many helpful flags and properties are set on the `Response` object, ranging from the response text, parsed response body, header fields, status flags and more. | ||
### Response text | ||
The `res.text` property contains the unparsed response body string. This | ||
property is always present for the client API, and only when the mime type | ||
matches "text/*", "*/json", or "x-www-form-urlencoded" by default for node. The | ||
reasoning is to conserve memory, as buffering text of large bodies such as multipart files or images is extremely inefficient. | ||
The `res.text` property contains the unparsed response body string. This property is always present for the client API, and only when the mime type matches "text/*", "*/json", or "x-www-form-urlencoded" by default for node. The reasoning is to conserve memory, as buffering text of large bodies such as multipart files or images is extremely inefficient. To force buffering see the "Buffering responses" section. | ||
To force buffering see the "Buffering responses" section. | ||
### Response body | ||
Much like SuperAgent can auto-serialize request data, it can also automatically parse it. When a parser is defined for the Content-Type, it is parsed, which by default includes "application/json" and "application/x-www-form-urlencoded". The parsed object is then available via `res.body`. | ||
Much like SuperAgent can auto-serialize request data, it can also automatically parse it. When a parser is defined for the Content-Type, it is parsed, which by default includes "application/json" and "application/x-www-form-urlencoded". The parsed object is then available via `res.body`. | ||
### Response header fields | ||
The `res.header` contains an object of parsed header fields, lowercasing field names much like node does. For example `res.header['content-length']`. | ||
The `res.header` contains an object of parsed header fields, lowercasing field names much like node does. For example `res.header['content-length']`. | ||
### Response Content-Type | ||
The Content-Type response header is special-cased, providing `res.type`, which is void of the charset (if any). For example the Content-Type of "text/html; charset=utf8" will provide "text/html" as `res.type`, and the `res.charset` property would then contain "utf8". | ||
The Content-Type response header is special-cased, providing `res.type`, which is void of the charset (if any). For example the Content-Type of "text/html; charset=utf8" will provide "text/html" as `res.type`, and the `res.charset` property would then contain "utf8". | ||
### Response status | ||
The response status flags help determine if the request was a success, among other useful information, making SuperAgent ideal for interacting with RESTful web services. These flags are currently defined as: | ||
The response status flags help determine if the request was a success, among other useful information, making SuperAgent ideal for interacting with RESTful web services. These flags are currently defined as: | ||
@@ -418,3 +419,3 @@ var type = status / 100 | 0; | ||
To abort requests simply invoke the `req.abort()` method. | ||
To abort requests simply invoke the `req.abort()` method. | ||
@@ -445,3 +446,3 @@ ## Timeouts | ||
In both Node and browsers auth available via the `.auth()` method: | ||
In both Node and browsers auth available via the `.auth()` method: | ||
@@ -454,7 +455,7 @@ request | ||
In the _Node_ client Basic auth can be in the URL as "user:pass": | ||
In the _Node_ client Basic auth can be in the URL as "user:pass": | ||
request.get('http://tobi:learnboost@local').end(callback); | ||
By default only `Basic` auth is used. In browser you can add `{type:'auto'}` to enable all methods built-in in the browser (Digest, NTLM, etc.): | ||
By default only `Basic` auth is used. In browser you can add `{type:'auto'}` to enable all methods built-in in the browser (Digest, NTLM, etc.): | ||
@@ -465,3 +466,3 @@ request.auth('digest', 'secret', {type:'auto'}) | ||
By default up to 5 redirects will be followed, however you may specify this with the `res.redirects(n)` method: | ||
By default up to 5 redirects will be followed, however you may specify this with the `res.redirects(n)` method: | ||
@@ -475,3 +476,3 @@ request | ||
In Node SuperAgent does not save cookies by default, but you can use the `.agent()` method to create a copy of SuperAgent that saves cookies. Each copy has a separate cookie jar. | ||
In Node SuperAgent does not save cookies by default, but you can use the `.agent()` method to create a copy of SuperAgent that saves cookies. Each copy has a separate cookie jar. | ||
@@ -485,7 +486,7 @@ const agent = request.agent(); | ||
In browsers cookies are managed automatically by the browser, and there is no `.agent()` method. | ||
In browsers cookies are managed automatically by the browser, and there is no `.agent()` method. | ||
## Piping data | ||
The Node client allows you to pipe data to and from the request. For example piping a file's contents as the request: | ||
The Node client allows you to pipe data to and from the request. For example piping a file's contents as the request: | ||
@@ -500,3 +501,3 @@ const request = require('superagent'); | ||
Or piping the response to a file: | ||
Or piping the response to a file: | ||
@@ -509,7 +510,7 @@ const stream = fs.createWriteStream('path/to/my.json'); | ||
SuperAgent is also great for _building_ multipart requests for which it provides methods `.attach()` and `.field()`. | ||
SuperAgent is also great for _building_ multipart requests for which it provides methods `.attach()` and `.field()`. | ||
### Attaching files | ||
As mentioned a higher-level API is also provided, in the form of `.attach(name, [path], [filename])` and `.field(name, value)`/`.field(object)`. Attaching several files is simple, you can also provide a custom filename for the attachment, otherwise the basename of the attached file is used. | ||
As mentioned a higher-level API is also provided, in the form of `.attach(name, [path], [filename])` and `.field(name, value)`/`.field(object)`. Attaching several files is simple, you can also provide a custom filename for the attachment, otherwise the basename of the attached file is used. | ||
@@ -525,3 +526,3 @@ request | ||
Much like form fields in HTML, you can set field values with the `.field(name, value)` method. Suppose you want to upload a few images with your name and email, your request might look something like this: | ||
Much like form fields in HTML, you can set field values with the `.field(name, value)` method. Suppose you want to upload a few images with your name and email, your request might look something like this: | ||
@@ -538,18 +539,15 @@ request | ||
The node client supports compressed responses, best of all, you don't have to do anything! It just works. | ||
The node client supports compressed responses, best of all, you don't have to do anything! It just works. | ||
## Buffering responses | ||
To force buffering of response bodies as `res.text` you may invoke `req.buffer()`. To undo the default of buffering for text responses such | ||
as "text/plain", "text/html" etc you may invoke `req.buffer(false)`. | ||
To force buffering of response bodies as `res.text` you may invoke `req.buffer()`. To undo the default of buffering for text responses such as "text/plain", "text/html" etc you may invoke `req.buffer(false)`. | ||
When buffered the `res.buffered` flag is provided, you may use this to | ||
handle both buffered and unbuffered responses in the same callback. | ||
When buffered the `res.buffered` flag is provided, you may use this to handle both buffered and unbuffered responses in the same callback. | ||
## CORS | ||
For security reasons, browsers will block cross-origin requests unless the server opts-in using CORS headers. Browsers will also make extra __OPTIONS__ requests to check what HTTP headers and methods are allowed by the server. [Read more about CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS). | ||
For security reasons, browsers will block cross-origin requests unless the server opts-in using CORS headers. Browsers will also make extra __OPTIONS__ requests to check what HTTP headers and methods are allowed by the server. [Read more about CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS). | ||
The `.withCredentials()` method enables the ability to send cookies | ||
from the origin, however only when `Access-Control-Allow-Origin` is _not_ a wildcard ("*"), and `Access-Control-Allow-Credentials` is "true". | ||
The `.withCredentials()` method enables the ability to send cookies from the origin, however only when `Access-Control-Allow-Origin` is _not_ a wildcard ("*"), and `Access-Control-Allow-Credentials` is "true". | ||
@@ -585,9 +583,7 @@ request | ||
Note that a 4xx or 5xx response with super agent **are** considered an error by default. For example if you get a 500 or 403 response, this status information will be available via `err.status`. Errors from such responses also contain an `err.response` field with all of the properties mentioned in "[Response properties](#response-properties)". The library behaves in this way to handle the common case of wanting success responses and treating HTTP error status codes as errors while still allowing for custom logic around specific error conditions. | ||
Note that a 4xx or 5xx response with super agent **are** considered an error by default. For example if you get a 500 or 403 response, this status information will be available via `err.status`. Errors from such responses also contain an `err.response` field with all of the properties mentioned in "[Response properties](#response-properties)". The library behaves in this way to handle the common case of wanting success responses and treating HTTP error status codes as errors while still allowing for custom logic around specific error conditions. | ||
Network failures, timeouts, and other errors that produce no response will contain no `err.status` or `err.response` fields. | ||
Network failures, timeouts, and other errors that produce no response will contain no `err.status` or `err.response` fields. | ||
If you wish to handle 404 or other HTTP error responses, you can query the `err.status` property. | ||
When an HTTP error occurs (4xx or 5xx response) the `res.error` property is an `Error` object, | ||
this allows you to perform checks such as: | ||
If you wish to handle 404 or other HTTP error responses, you can query the `err.status` property. When an HTTP error occurs (4xx or 5xx response) the `res.error` property is an `Error` object, this allows you to perform checks such as: | ||
@@ -643,3 +639,3 @@ if (err && err.status === 404) { | ||
If want to use WebPack to compile code for Node.JS, you *must* specify [node target](webpack.github.io/docs/configuration.html#target) in its configuration. | ||
If want to use WebPack to compile code for Node.JS, you *must* specify [node target](https://webpack.github.io/docs/configuration.html#target) in its configuration. | ||
@@ -646,0 +642,0 @@ ### Using browser version in electron |
@@ -0,1 +1,9 @@ | ||
# 3.6.0 (2017-08-20) | ||
* Support disabling TCP_NODELAY option (#1240) (xiamengyu) | ||
* Send payload in query string for GET and HEAD shorthand API (Peter Lyons) | ||
* Support passphrase with pfx certificate (Paul Westerdale (ABRS Limited)) | ||
* Documentation improvements (Peter Lyons) | ||
* Fixed duplicated query string params (#1200) (Kornel) | ||
# 3.5.1 (2017-03-18) | ||
@@ -2,0 +10,0 @@ |
@@ -62,3 +62,3 @@ /** | ||
} | ||
throw Error("Browser-only verison of superagent could not find XHR"); | ||
throw Error("Browser-only version of superagent could not find XHR"); | ||
}; | ||
@@ -173,3 +173,3 @@ | ||
json: 'application/json', | ||
xml: 'application/xml', | ||
xml: 'text/xml', | ||
urlencoded: 'application/x-www-form-urlencoded', | ||
@@ -530,6 +530,6 @@ 'form': 'application/x-www-form-urlencoded', | ||
break; | ||
case 'bearer': // usage would be .auth(accessToken, { type: 'bearer' }) | ||
this.set('Authorization', 'Bearer ' + user); | ||
break; | ||
break; | ||
} | ||
@@ -813,3 +813,3 @@ return this; | ||
if ('function' == typeof data) fn = data, data = null; | ||
if (data) req.send(data); | ||
if (data) req.query(data); | ||
if (fn) req.end(fn); | ||
@@ -816,0 +816,0 @@ return req; |
@@ -531,3 +531,8 @@ | ||
Request.prototype.pfx = function(cert){ | ||
this._pfx = cert; | ||
if(typeof cert === 'object' && !Buffer.isBuffer(cert)){ | ||
this._pfx = cert.pfx; | ||
this._passphrase = cert.passphrase; | ||
} else { | ||
this._pfx = cert; | ||
} | ||
return this; | ||
@@ -600,2 +605,3 @@ }; | ||
options.cert = this._cert; | ||
options.passphrase = this._passphrase; | ||
options.agent = this._agent; | ||
@@ -608,2 +614,6 @@ | ||
var req = this.req = mod.request(options); | ||
// set tcp no delay | ||
req.setNoDelay(true); | ||
if ('HEAD' != options.method) { | ||
@@ -980,3 +990,9 @@ req.setHeader('Accept-Encoding', 'gzip, deflate'); | ||
if ('function' == typeof data) fn = data, data = null; | ||
if (data) req.send(data); | ||
if (data) { | ||
if (method === 'GET' || method === 'HEAD') { | ||
req.query(data); | ||
} else { | ||
req.send(data); | ||
} | ||
} | ||
fn && req.end(fn); | ||
@@ -983,0 +999,0 @@ return req; |
@@ -111,3 +111,3 @@ /** | ||
* | ||
* @param {Number|Object} ms or {response, read, deadline} | ||
* @param {Number|Object} ms or {response, deadline} | ||
* @return {Request} for chaining | ||
@@ -114,0 +114,0 @@ * @api public |
{ | ||
"name": "superagent", | ||
"version": "3.5.3-beta.2", | ||
"version": "3.6.0", | ||
"description": "elegant & feature rich browser / node HTTP with a fluent API", | ||
@@ -34,3 +34,3 @@ "scripts": { | ||
"methods": "^1.1.1", | ||
"mime": "^1.3.4", | ||
"mime": "^1.3.6", | ||
"qs": "^6.4.0", | ||
@@ -65,4 +65,4 @@ "readable-stream": "^2.0.5" | ||
"engines": { | ||
"node": ">= 0.12" | ||
"node": ">= 4.0" | ||
} | ||
} |
@@ -22,3 +22,3 @@ # SuperAgent [![Build Status](https://travis-ci.org/visionmedia/superagent.svg?branch=master)](https://travis-ci.org/visionmedia/superagent) | ||
.post('/api/pet') | ||
.send({ name: 'Manny', species: 'cat' }) | ||
.send({ name: 'Manny', species: 'cat' }) // sends a JSON post body | ||
.set('X-API-Key', 'foobar') | ||
@@ -68,4 +68,4 @@ .set('Accept', 'application/json') | ||
* [superagent-mocker](https://github.com/shuvalov-anton/superagent-mocker) — simulate REST API | ||
* [superagent-cache](https://github.com/jpodwys/superagent-cache) - A global SuperAgent patch with built-in, flexible caching (compatible with SuperAgent `1.x`) | ||
* [superagent-cache-plugin](https://github.com/jpodwys/superagent-cache-plugin) - A SuperAgent plugin with built-in, flexible caching (compatible with SuperAgent `1.x`) | ||
* [superagent-cache](https://github.com/jpodwys/superagent-cache) - A global SuperAgent patch with built-in, flexible caching | ||
* [superagent-cache-plugin](https://github.com/jpodwys/superagent-cache-plugin) - A SuperAgent plugin with built-in, flexible caching | ||
* [superagent-jsonapify](https://github.com/alex94puchades/superagent-jsonapify) - A lightweight [json-api](http://jsonapi.org/format/) client addon for superagent | ||
@@ -72,0 +72,0 @@ * [superagent-serializer](https://github.com/zzarcon/superagent-serializer) - Converts server payload into different cases |
@@ -127,3 +127,3 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.superagent = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
* | ||
* @param {Number|Object} ms or {response, read, deadline} | ||
* @param {Number|Object} ms or {response, deadline} | ||
* @return {Request} for chaining | ||
@@ -1095,3 +1095,3 @@ * @api public | ||
} | ||
throw Error("Browser-only verison of superagent could not find XHR"); | ||
throw Error("Browser-only version of superagent could not find XHR"); | ||
}; | ||
@@ -1206,3 +1206,3 @@ | ||
json: 'application/json', | ||
xml: 'application/xml', | ||
xml: 'text/xml', | ||
urlencoded: 'application/x-www-form-urlencoded', | ||
@@ -1563,6 +1563,6 @@ 'form': 'application/x-www-form-urlencoded', | ||
break; | ||
case 'bearer': // usage would be .auth(accessToken, { type: 'bearer' }) | ||
this.set('Authorization', 'Bearer ' + user); | ||
break; | ||
break; | ||
} | ||
@@ -1846,3 +1846,3 @@ return this; | ||
if ('function' == typeof data) fn = data, data = null; | ||
if (data) req.send(data); | ||
if (data) req.query(data); | ||
if (fn) req.end(fn); | ||
@@ -1849,0 +1849,0 @@ return req; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
375738
4475
1
Updatedmime@^1.3.6