Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deps: update http-errors to v2.0.0 #1486

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions __tests__/application/use.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,9 @@ describe('app.use(fn)', () => {
it('should catch thrown errors in non-async functions', () => {
const app = new Koa()

app.use(ctx => ctx.throw('Not Found', 404))
app.use(ctx => ctx.throw(404, 'Not Found'))

return request(app.callback())
.get('/')
.expect(404)
return request(app.callback()).get('/').expect(404)
})

it('should throw error for non-function', () => {
Expand Down
29 changes: 0 additions & 29 deletions __tests__/context/throw.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,6 @@ describe('ctx.throw(err)', () => {
})
})

describe('ctx.throw(err, status)', () => {
it('should throw the error and set .status', () => {
const ctx = context()
const error = new Error('test')

try {
ctx.throw(error, 422)
} catch (err) {
assert.strictEqual(err.status, 422)
assert.strictEqual(err.message, 'test')
assert.strictEqual(err.expose, true)
}
})
})

Comment on lines -35 to -49
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

describe('ctx.throw(status, err)', () => {
it('should throw the error and set .status', () => {
const ctx = context()
Expand All @@ -62,20 +47,6 @@ describe('ctx.throw(status, err)', () => {
})
})

describe('ctx.throw(msg, status)', () => {
it('should throw an error', () => {
const ctx = context()

try {
ctx.throw('name required', 400)
} catch (err) {
assert.strictEqual(err.message, 'name required')
assert.strictEqual(err.status, 400)
assert.strictEqual(err.expose, true)
}
})
})

describe('ctx.throw(status, msg)', () => {
it('should throw an error', () => {
const ctx = context()
Expand Down
48 changes: 31 additions & 17 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"escape-html": "^1.0.3",
"fresh": "~0.5.2",
"http-assert": "^1.3.0",
"http-errors": "^1.6.3",
3imed-jaberi marked this conversation as resolved.
Show resolved Hide resolved
"http-errors": "^2.0.0",
"koa-compose": "^4.1.0",
"on-finished": "^2.3.0",
"parseurl": "^1.3.2",
Expand Down
Loading