Skip to content

Commit 3435e78

Browse files
committed
lint++
1 parent 2cd6618 commit 3435e78

8 files changed

Lines changed: 30 additions & 58 deletions

File tree

__tests__/request/header.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ describe('req.header', () => {
1212

1313
it('should set the request header object', () => {
1414
const req = request();
15-
req.header = {'X-Custom-Headerfield': 'Its one header, with headerfields'};
15+
req.header = { 'X-Custom-Headerfield': 'Its one header, with headerfields' };
1616
assert.deepStrictEqual(req.header, req.req.headers);
1717
});
1818
});

__tests__/request/headers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ describe('req.headers', () => {
1212

1313
it('should set the request header object', () => {
1414
const req = request();
15-
req.headers = {'X-Custom-Headerfield': 'Its one header, with headerfields'};
15+
req.headers = { 'X-Custom-Headerfield': 'Its one header, with headerfields' };
1616
assert.deepStrictEqual(req.headers, req.req.headers);
1717
});
1818
});

__tests__/request/host.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ describe('req.host', () => {
2121
describe('when less then HTTP/2', () => {
2222
it('should not use :authority header', () => {
2323
const req = request({
24-
'httpVersionMajor': 1,
25-
'httpVersion': '1.1'
24+
httpVersionMajor: 1,
25+
httpVersion: '1.1'
2626
});
2727
req.header[':authority'] = 'foo.com:3000';
2828
req.header.host = 'bar.com:8000';
@@ -33,8 +33,8 @@ describe('req.host', () => {
3333
describe('when HTTP/2', () => {
3434
it('should use :authority header', () => {
3535
const req = request({
36-
'httpVersionMajor': 2,
37-
'httpVersion': '2.0'
36+
httpVersionMajor: 2,
37+
httpVersion: '2.0'
3838
});
3939
req.header[':authority'] = 'foo.com:3000';
4040
req.header.host = 'bar.com:8000';
@@ -43,8 +43,8 @@ describe('req.host', () => {
4343

4444
it('should use host header as fallback', () => {
4545
const req = request({
46-
'httpVersionMajor': 2,
47-
'httpVersion': '2.0'
46+
httpVersionMajor: 2,
47+
httpVersion: '2.0'
4848
});
4949
req.header.host = 'bar.com:8000';
5050
assert.strictEqual(req.host, 'bar.com:8000');
@@ -62,8 +62,8 @@ describe('req.host', () => {
6262

6363
it('should be ignored on HTTP/2', () => {
6464
const req = request({
65-
'httpVersionMajor': 2,
66-
'httpVersion': '2.0'
65+
httpVersionMajor: 2,
66+
httpVersion: '2.0'
6767
});
6868
req.header['x-forwarded-host'] = 'proxy.com:8080';
6969
req.header[':authority'] = 'foo.com:3000';
@@ -83,8 +83,8 @@ describe('req.host', () => {
8383

8484
it('should be used on HTTP/2', () => {
8585
const req = request({
86-
'httpVersionMajor': 2,
87-
'httpVersion': '2.0'
86+
httpVersionMajor: 2,
87+
httpVersion: '2.0'
8888
});
8989
req.app.proxy = true;
9090
req.header['x-forwarded-host'] = 'proxy.com:8080';

__tests__/response/attachment.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ describe('ctx.attachment([filename])', () => {
3737

3838
app.use((ctx, next) => {
3939
ctx.attachment('path/to/include-no-ascii-char-中文名-ok.json');
40-
ctx.body = {foo: 'bar'};
40+
ctx.body = { foo: 'bar' };
4141
});
4242

4343
return request(app.callback())
4444
.get('/')
4545
.expect('content-disposition', 'attachment; filename="include-no-ascii-char-???-ok.json"; filename*=UTF-8\'\'include-no-ascii-char-%E4%B8%AD%E6%96%87%E5%90%8D-ok.json')
46-
.expect({foo: 'bar'})
46+
.expect({ foo: 'bar' })
4747
.expect(200);
4848
});
4949
});

__tests__/response/flushHeaders.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ describe('ctx.flushHeaders()', () => {
9191
app.use(ctx => {
9292
ctx.type = 'json';
9393
ctx.status = 200;
94-
ctx.headers['Link'] = '</css/mycss.css>; as=style; rel=preload, <https://img.craftflair.com>; rel=preconnect; crossorigin';
94+
ctx.headers.Link = '</css/mycss.css>; as=style; rel=preload, <https://img.craftflair.com>; rel=preconnect; crossorigin';
9595
const stream = ctx.body = new PassThrough();
9696
ctx.flushHeaders();
9797

@@ -134,7 +134,7 @@ describe('ctx.flushHeaders()', () => {
134134
app.use(ctx => {
135135
ctx.type = 'json';
136136
ctx.status = 200;
137-
ctx.headers['Link'] = '</css/mycss.css>; as=style; rel=preload, <https://img.craftflair.com>; rel=preconnect; crossorigin';
137+
ctx.headers.Link = '</css/mycss.css>; as=style; rel=preload, <https://img.craftflair.com>; rel=preconnect; crossorigin';
138138
ctx.length = 20;
139139
ctx.flushHeaders();
140140
const stream = ctx.body = new PassThrough();

__tests__/response/set.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ describe('ctx.set(name, val)', () => {
2525

2626
it('should set a field value of array', () => {
2727
const ctx = context();
28-
ctx.set('x-foo', ['foo', 'bar', 123 ]);
29-
assert.deepStrictEqual(ctx.response.header['x-foo'], [ 'foo', 'bar', '123' ]);
28+
ctx.set('x-foo', ['foo', 'bar', 123]);
29+
assert.deepStrictEqual(ctx.response.header['x-foo'], ['foo', 'bar', '123']);
3030
});
3131
});
3232

__tests__/response/status.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ describe('res.status=', () => {
4646
describe('and HTTP/2', () => {
4747
it('should not set the status message', () => {
4848
const res = response({
49-
'httpVersionMajor': 2,
50-
'httpVersion': '2.0'
49+
httpVersionMajor: 2,
50+
httpVersion: '2.0'
5151
});
5252
res.status = 200;
5353
assert(!res.res.statusMessage);

package-lock.json

Lines changed: 10 additions & 38 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)