Skip to content

Commit 3c9c0f7

Browse files
committed
chore: bump deps, including form-data (closes #1267)
1 parent e2987e3 commit 3c9c0f7

File tree

10 files changed

+2335
-2232
lines changed

10 files changed

+2335
-2232
lines changed

.dist.eslintrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131
"Symbol",
3232
"Object.getOwnPropertySymbols",
3333
"Object.setPrototypeOf",
34-
"Set"
34+
"Set",
35+
"Math.trunc"
3536
]
3637
}
3738
}

README.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ Browser-ready versions of this module are available via [jsdelivr][], [unpkg][],
8383
This is the solution for you if you're just using `<script>` tags everywhere!
8484

8585
```html
86-
<script src="https://polyfill.io/v3/polyfill.min.js?features=Array.from,Promise,Symbol,Object.setPrototypeOf,Object.getOwnPropertySymbols,Set"></script>
86+
<script src="https://polyfill.io/v3/polyfill.min.js?features=Array.from,Promise,Symbol,Object.setPrototypeOf,Object.getOwnPropertySymbols,Set,Math.trunc"></script>
8787
<script src="https://cdn.jsdelivr.net/npm/superagent"></script>
8888
<!-- if you wish to use unpkg.com instead: -->
8989
<!-- <script src="https://unpkg.com/superagent"></script> -->
@@ -159,11 +159,11 @@ If you are using [browserify][], [webpack][], [rollup][], or another bundler, th
159159
We recommend using <https://polyfill.io> (specifically with the bundle mentioned in [VanillaJS](#vanillajs) above):
160160

161161
```html
162-
<script src="https://polyfill.io/v3/polyfill.min.js?features=Array.from,Promise,Symbol,Object.setPrototypeOf,Object.getOwnPropertySymbols,Set"></script>
162+
<script src="https://polyfill.io/v3/polyfill.min.js?features=Array.from,Promise,Symbol,Object.setPrototypeOf,Object.getOwnPropertySymbols,Set,Math.trunc"></script>
163163
```
164164

165165
* IE 9-10 requires a polyfill for `Promise`, `Array.from`, `Symbol`, `Object.getOwnPropertySymbols`, and `Object.setPrototypeOf`
166-
* IE 9 requires a polyfill for `window.FormData` (we recommend [formdata-polyfill][]) and `Set`
166+
* IE 9 requires a polyfill for `window.FormData` (we recommend [formdata-polyfill][]), `Set`, and `Math.trunc`
167167

168168

169169
## Plugins
@@ -210,10 +210,12 @@ For SuperAgent extensions such as couchdb and oauth visit the [wiki](https://git
210210

211211
## Upgrading from previous versions
212212

213+
Please see [GitHub releases page](https://github.com/visionmedia/superagent/releases) for the current changelog.
214+
213215
Our breaking changes are mostly in rarely used functionality and from stricter error handling.
214216

215217
* [6.0 to 6.1](https://github.com/visionmedia/superagent/releases/tag/v6.1.0)
216-
* Browser behaviour changed to match Node when serializing `application/x-www-form-urlencoded`, using `arrayFormat: 'indices'` semantics of `qs` library. (See: https://www.npmjs.com/package/qs#stringifying)
218+
* Browser behaviour changed to match Node when serializing `application/x-www-form-urlencoded`, using `arrayFormat: 'indices'` semantics of `qs` library. (See: <https://www.npmjs.com/package/qs#stringifying>)
217219
* [5.x to 6.x](https://github.com/visionmedia/superagent/releases/tag/v6.0.0):
218220
* Retry behavior is still opt-in, however we now have a more fine-grained list of status codes and error codes that we retry against (see updated docs)
219221
* A specific issue with Content-Type matching not being case-insensitive is fixed
@@ -231,7 +233,7 @@ Our breaking changes are mostly in rarely used functionality and from stricter e
231233
* Ensure you're running Node 4 or later. We've dropped support for Node 0.x.
232234
* Test code that calls `.send()` multiple times. Invalid calls to `.send()` will now throw instead of sending garbage.
233235
* [1.x to 2.x](https://github.com/visionmedia/superagent/releases/tag/v2.0.0):
234-
* If you use `.parse()` in the _browser_ version, rename it to `.serialize()`.
236+
* If you use `.parse()` in the *browser* version, rename it to `.serialize()`.
235237
* If you rely on `undefined` in query-string values being sent literally as the text "undefined", switch to checking for missing value instead. `?key=undefined` is now `?key` (without a value).
236238
* If you use `.then()` in Internet Explorer, ensure that you have a polyfill that adds a global `Promise` object.
237239
* 0.x to 1.x:
@@ -253,7 +255,7 @@ Our breaking changes are mostly in rarely used functionality and from stricter e
253255
[MIT](LICENSE) © TJ Holowaychuk
254256

255257

256-
##
258+
##
257259

258260
[npm]: https://www.npmjs.com/
259261

package.json

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -25,51 +25,51 @@
2525
"dependencies": {
2626
"component-emitter": "^1.3.0",
2727
"cookiejar": "^2.1.2",
28-
"debug": "^4.1.1",
28+
"debug": "^4.3.1",
2929
"fast-safe-stringify": "^2.0.7",
30-
"form-data": "^3.0.0",
30+
"form-data": "^4.0.0",
3131
"formidable": "^1.2.2",
3232
"methods": "^1.1.2",
33-
"mime": "^2.4.6",
34-
"qs": "^6.9.4",
33+
"mime": "^2.5.0",
34+
"qs": "^6.9.6",
3535
"readable-stream": "^3.6.0",
36-
"semver": "^7.3.2"
36+
"semver": "^7.3.4"
3737
},
3838
"devDependencies": {
39-
"@babel/cli": "^7.10.5",
40-
"@babel/core": "^7.11.1",
41-
"@babel/plugin-transform-runtime": "^7.11.0",
42-
"@babel/preset-env": "^7.11.0",
43-
"@commitlint/cli": "^9.1.1",
44-
"@commitlint/config-conventional": "^9.1.1",
39+
"@babel/cli": "^7.12.16",
40+
"@babel/core": "^7.12.16",
41+
"@babel/plugin-transform-runtime": "^7.12.15",
42+
"@babel/preset-env": "^7.12.16",
43+
"@commitlint/cli": "^11.0.0",
44+
"@commitlint/config-conventional": "^11.0.0",
4545
"Base64": "^1.1.0",
4646
"babelify": "^10.0.0",
4747
"basic-auth-connect": "^1.0.0",
4848
"body-parser": "^1.19.0",
49-
"browserify": "^16.5.2",
50-
"codecov": "^3.7.2",
49+
"browserify": "^17.0.0",
50+
"codecov": "^3.8.1",
5151
"cookie-parser": "^1.4.5",
52-
"cross-env": "^7.0.2",
53-
"eslint": "^7.6.0",
54-
"eslint-config-xo-lass": "^1.0.3",
55-
"eslint-plugin-compat": "^3.8.0",
52+
"cross-env": "^7.0.3",
53+
"eslint": "^7.20.0",
54+
"eslint-config-xo-lass": "^1.0.5",
55+
"eslint-plugin-compat": "^3.9.0",
5656
"eslint-plugin-node": "^11.1.0",
5757
"express": "^4.17.1",
5858
"express-session": "^1.17.1",
59-
"fixpack": "^3.0.6",
60-
"husky": "^4.2.5",
61-
"lint-staged": "^10.2.11",
62-
"marked": "^1.1.1",
59+
"fixpack": "^4.0.0",
60+
"husky": "^5.0.9",
61+
"lint-staged": "^10.5.4",
62+
"marked": "^2.0.0",
6363
"mocha": "3.5.3",
6464
"multer": "^1.4.2",
6565
"nyc": "^15.1.0",
66-
"remark-cli": "^8.0.1",
67-
"remark-preset-github": "^3.0.0",
66+
"remark-cli": "^9.0.0",
67+
"remark-preset-github": "^4.0.1",
6868
"rimraf": "^3.0.2",
6969
"should": "^13.2.3",
7070
"should-http": "^0.1.1",
7171
"tinyify": "^3.0.0",
72-
"xo": "0.32.1",
72+
"xo": "0.37.1",
7373
"zuul": "^3.12.0"
7474
},
7575
"engines": {
@@ -167,14 +167,14 @@
167167
"extends": [
168168
"xo-lass"
169169
],
170-
"env": [
170+
"envs": [
171171
"node",
172172
"browser"
173173
],
174174
"overrides": [
175175
{
176176
"files": "test/**/*.js",
177-
"env": [
177+
"envs": [
178178
"mocha"
179179
],
180180
"rules": {

src/node/index.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1044,13 +1044,11 @@ Request.prototype._end = function () {
10441044
}
10451045

10461046
let parser = this._parser;
1047-
if (undefined === buffer) {
1048-
if (parser) {
1049-
console.warn(
1050-
"A custom superagent parser has been set, but buffering strategy for the parser hasn't been configured. Call `req.buffer(true or false)` or set `superagent.buffer[mime] = true or false`"
1051-
);
1052-
buffer = true;
1053-
}
1047+
if (undefined === buffer && parser) {
1048+
console.warn(
1049+
"A custom superagent parser has been set, but buffering strategy for the parser hasn't been configured. Call `req.buffer(true or false)` or set `superagent.buffer[mime] = true or false`"
1050+
);
1051+
buffer = true;
10541052
}
10551053

10561054
if (!parser) {
@@ -1093,7 +1091,7 @@ Request.prototype._end = function () {
10931091
// Protectiona against zip bombs and other nuisance
10941092
let responseBytesLeft = this._maxResponseSize || 200000000;
10951093
res.on('data', (buf) => {
1096-
responseBytesLeft -= buf.byteLength || buf.length;
1094+
responseBytesLeft -= buf.byteLength || buf.length > 0 ? buf.length : 0;
10971095
if (responseBytesLeft < 0) {
10981096
// This will propagate through error event
10991097
const err = new Error('Maximum response size reached');

src/response-base.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ ResponseBase.prototype._setHeaderProperties = function (header) {
110110
*/
111111

112112
ResponseBase.prototype._setStatusProperties = function (status) {
113-
const type = (status / 100) | 0;
113+
const type = Math.trunc(status / 100);
114114

115115
// status / class
116116
this.statusCode = status;

test/node/https.js

Lines changed: 36 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -49,23 +49,21 @@ let testEndpoint;
4949
describe('https', () => {
5050
describe('certificate authority', () => {
5151
before(function listen(done) {
52-
if (process.env.HTTP2_TEST) {
53-
server = http2.createSecureServer(
54-
{
55-
key,
56-
cert
57-
},
58-
app
59-
);
60-
} else {
61-
server = https.createServer(
62-
{
63-
key,
64-
cert
65-
},
66-
app
67-
);
68-
}
52+
server = process.env.HTTP2_TEST
53+
? http2.createSecureServer(
54+
{
55+
key,
56+
cert
57+
},
58+
app
59+
)
60+
: https.createServer(
61+
{
62+
key,
63+
cert
64+
},
65+
app
66+
);
6967

7068
server.listen(0, function listening() {
7169
testEndpoint = `${base}:${server.address().port}`;
@@ -143,29 +141,27 @@ describe('https', () => {
143141

144142
describe.skip('client certificates', () => {
145143
before(function listen(done) {
146-
if (process.env.HTTP2_TEST) {
147-
server = http2.createSecureServer(
148-
{
149-
ca,
150-
key,
151-
cert,
152-
requestCert: true,
153-
rejectUnauthorized: true
154-
},
155-
app
156-
);
157-
} else {
158-
server = https.createServer(
159-
{
160-
ca,
161-
key,
162-
cert,
163-
requestCert: true,
164-
rejectUnauthorized: true
165-
},
166-
app
167-
);
168-
}
144+
server = process.env.HTTP2_TEST
145+
? http2.createSecureServer(
146+
{
147+
ca,
148+
key,
149+
cert,
150+
requestCert: true,
151+
rejectUnauthorized: true
152+
},
153+
app
154+
)
155+
: https.createServer(
156+
{
157+
ca,
158+
key,
159+
cert,
160+
requestCert: true,
161+
rejectUnauthorized: true
162+
},
163+
app
164+
);
169165

170166
server.listen(0, function listening() {
171167
testEndpoint = `${base}:${server.address().port}`;

test/node/unix-sockets.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,9 @@ describe('[unix-sockets] https', () => {
8383
fs.unlinkSync(httpsSockPath);
8484
}
8585

86-
if (process.env.HTTP2_TEST) {
87-
httpsServer = https.createSecureServer({ key, cert }, app);
88-
} else {
89-
httpsServer = https.createServer({ key, cert }, app);
90-
}
86+
httpsServer = process.env.HTTP2_TEST
87+
? https.createSecureServer({ key, cert }, app)
88+
: https.createServer({ key, cert }, app);
9189

9290
httpsServer.listen(httpsSockPath, done);
9391
});

test/support/express/responseDecorator.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,8 @@ function setMethods(res) {
171171

172172
// populate ETag
173173
let etag;
174-
if (generateETag && len !== undefined) {
175-
if ((etag = etagFn(chunk, encoding))) {
176-
this.set('ETag', etag);
177-
}
174+
if (generateETag && len !== undefined && (etag = etagFn(chunk, encoding))) {
175+
this.set('ETag', etag);
178176
}
179177

180178
// freshness
@@ -260,7 +258,7 @@ function setMethods(res) {
260258
}
261259

262260
// jsonp
263-
if (typeof callback === 'string' && callback.length !== 0) {
261+
if (typeof callback === 'string' && callback.length > 0) {
264262
this.set('X-Content-Type-Options', 'nosniff');
265263
this.set('Content-Type', 'text/javascript');
266264

test/support/server.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ app.get('/delay/slowbody/finish', (req, res) => {
265265
});
266266

267267
app.get('/delay/:ms', (req, res) => {
268-
const ms = ~~req.params.ms;
268+
const ms = Math.trunc(req.params.ms);
269269
setTimeout(() => {
270270
res.sendStatus(200);
271271
}, ms);
@@ -544,7 +544,7 @@ app.get('/delay/:ms/ok/:id', (req, res) => {
544544
const { id } = req.params;
545545
if (!called[id]) {
546546
called[id] = true;
547-
const ms = ~~req.params.ms;
547+
const ms = Math.trunc(req.params.ms);
548548
setTimeout(() => {
549549
res.sendStatus(200);
550550
}, ms);

0 commit comments

Comments
 (0)