Skip to content

Commit f8b49b8

Browse files
authored
chore: fix grammatical and spelling errors in comments and tests (#1490)
1 parent d1c9263 commit f8b49b8

16 files changed

Lines changed: 44 additions & 40 deletions

File tree

lib/application.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,4 +278,5 @@ function respond(ctx) {
278278
* Make HttpError available to consumers of the library so that consumers don't
279279
* have a direct dependency upon `http-errors`
280280
*/
281+
281282
module.exports.HttpError = HttpError;

lib/request.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ module.exports = {
146146
},
147147

148148
/**
149-
* Set pathname, retaining the query-string when present.
149+
* Set pathname, retaining the query string when present.
150150
*
151151
* @param {String} path
152152
* @api public
@@ -163,7 +163,7 @@ module.exports = {
163163
},
164164

165165
/**
166-
* Get parsed query-string.
166+
* Get parsed query string.
167167
*
168168
* @return {Object}
169169
* @api public
@@ -176,7 +176,7 @@ module.exports = {
176176
},
177177

178178
/**
179-
* Set query-string as an object.
179+
* Set query string as an object.
180180
*
181181
* @param {Object} obj
182182
* @api public
@@ -199,7 +199,7 @@ module.exports = {
199199
},
200200

201201
/**
202-
* Set querystring.
202+
* Set query string.
203203
*
204204
* @param {String} str
205205
* @api public
@@ -216,7 +216,7 @@ module.exports = {
216216
},
217217

218218
/**
219-
* Get the search string. Same as the querystring
219+
* Get the search string. Same as the query string
220220
* except it includes the leading ?.
221221
*
222222
* @return {String}
@@ -406,7 +406,7 @@ module.exports = {
406406
},
407407

408408
/**
409-
* Short-hand for:
409+
* Shorthand for:
410410
*
411411
* this.protocol == 'https'
412412
*
@@ -422,7 +422,7 @@ module.exports = {
422422
* When `app.proxy` is `true`, parse
423423
* the "X-Forwarded-For" ip address list.
424424
*
425-
* For example if the value were "client, proxy1, proxy2"
425+
* For example if the value was "client, proxy1, proxy2"
426426
* you would receive the array `["client", "proxy1", "proxy2"]`
427427
* where "proxy2" is the furthest down-stream.
428428
*
@@ -495,6 +495,7 @@ module.exports = {
495495
* @return {Object}
496496
* @api private
497497
*/
498+
498499
get accept() {
499500
return this._accept || (this._accept = accepts(this.req));
500501
},
@@ -505,6 +506,7 @@ module.exports = {
505506
* @param {Object}
506507
* @api private
507508
*/
509+
508510
set accept(obj) {
509511
this._accept = obj;
510512
},
@@ -607,7 +609,7 @@ module.exports = {
607609

608610
/**
609611
* Check if the incoming request contains the "Content-Type"
610-
* header field, and it contains any of the give mime `type`s.
612+
* header field and if it contains any of the given mime `type`s.
611613
* If there is no request body, `null` is returned.
612614
* If there is no content type, `false` is returned.
613615
* Otherwise, it returns the first `type` that matches.

lib/response.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,7 @@ module.exports = {
433433
* @return {boolean}
434434
* @api public
435435
*/
436+
436437
has(field) {
437438
return typeof this.res.hasHeader === 'function'
438439
? this.res.hasHeader(field)
@@ -441,7 +442,7 @@ module.exports = {
441442
},
442443

443444
/**
444-
* Set header `field` to `val`, or pass
445+
* Set header `field` to `val` or pass
445446
* an object of header fields.
446447
*
447448
* Examples:
@@ -564,8 +565,9 @@ module.exports = {
564565
},
565566

566567
/**
567-
* Flush any set headers, and begin the body
568+
* Flush any set headers and begin the body
568569
*/
570+
569571
flushHeaders() {
570572
this.res.flushHeaders();
571573
}
@@ -577,6 +579,7 @@ module.exports = {
577579
* @return {Object}
578580
* @api public
579581
*/
582+
580583
/* istanbul ignore else */
581584
if (util.inspect.custom) {
582585
module.exports[util.inspect.custom] = module.exports.inspect;

test/application/onerror.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ describe('app.onerror(err)', () => {
6666
assert(msg === '\n Foo\n');
6767
});
6868

69-
it('should use err.toString() instad of err.stack', () => {
69+
it('should use err.toString() instead of err.stack', () => {
7070
const app = new Koa();
7171
app.env = 'dev';
7272

test/application/respond.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ describe('app.respond', () => {
238238
});
239239
});
240240

241-
describe('when no middleware are present', () => {
241+
describe('when no middleware is present', () => {
242242
it('should 404', () => {
243243
const app = new Koa();
244244

test/application/use.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ describe('app.use(fn)', () => {
9898
.expect('generator');
9999
});
100100

101-
it('should throw error for non function', () => {
101+
it('should throw error for non-function', () => {
102102
const app = new Koa();
103103

104104
[null, undefined, 0, false, 'not a function'].forEach(v => {

test/context/onerror.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ describe('ctx.onerror(err)', () => {
239239
});
240240

241241
describe('when non-error thrown', () => {
242-
it('should response non-error thrown message', () => {
242+
it('should respond with non-error thrown message', () => {
243243
const app = new Koa();
244244

245245
app.use((ctx, next) => {

test/request/accepts.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ describe('ctx.accepts(types)', () => {
6262
});
6363
});
6464

65-
describe('when present in Accept as an exact match', () => {
65+
describe('when value present in Accept is an exact match', () => {
6666
it('should return the type', () => {
6767
const ctx = context();
6868
ctx.req.headers.accept = 'text/plain, text/html';
@@ -71,7 +71,7 @@ describe('ctx.accepts(types)', () => {
7171
});
7272
});
7373

74-
describe('when present in Accept as a type match', () => {
74+
describe('when value present in Accept is a type match', () => {
7575
it('should return the type', () => {
7676
const ctx = context();
7777
ctx.req.headers.accept = 'application/json, */*';
@@ -81,7 +81,7 @@ describe('ctx.accepts(types)', () => {
8181
});
8282
});
8383

84-
describe('when present in Accept as a subtype match', () => {
84+
describe('when value present in Accept is a subtype match', () => {
8585
it('should return the type', () => {
8686
const ctx = context();
8787
ctx.req.headers.accept = 'application/json, text/*';

test/request/fresh.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ describe('ctx.fresh', () => {
3636
});
3737
});
3838

39-
describe('and etag do not match', () => {
39+
describe('and etag does not match', () => {
4040
it('should return false', () => {
4141
const ctx = context();
4242
ctx.status = 200;

test/request/hostname.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ describe('req.hostname', () => {
3131
assert.equal(req.hostname, '[::1]');
3232
});
3333

34-
it('should parse localhost with non special schema port', () => {
34+
it('should parse localhost with non-special schema port', () => {
3535
const req = request();
3636
req.header.host = '[::1]:1337';
3737
assert.equal(req.hostname, '[::1]');
3838
});
3939

40-
it('should reduce IPv6 with non special schema port, as hostname', () => {
40+
it('should reduce IPv6 with non-special schema port as hostname', () => {
4141
const req = request();
4242
req.header.host = '[2001:cdba:0000:0000:0000:0000:3257:9652]:1337';
4343
assert.equal(req.hostname, '[2001:cdba::3257:9652]');

0 commit comments

Comments
 (0)