Skip to content

Commit 83d5e7c

Browse files
committed
1 parent 0947d9d commit 83d5e7c

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,6 @@
4545
"typings": "^2.1.0"
4646
},
4747
"dependencies": {
48-
"servie": "^0.1.1"
48+
"servie": "^0.2.0"
4949
}
5050
}

src/index.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ describe('servie-lambda', () => {
2727
}
2828

2929
it('should support routers', (done) => {
30-
const handler = createHandler(function (req) {
31-
return Promise.resolve(new Response(req, {
30+
const handler = createHandler(function () {
31+
return Promise.resolve(new Response({
3232
status: 200,
3333
body: 'response'
3434
}))

src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ export function createHandler (fn: App, options: Options = {}) {
8383

8484
// Handle request and response errors.
8585
req.events.on('error', done)
86+
req.events.on('abort', () => done(null, { statusCode: 444 }))
8687

8788
// Marked request as finished.
8889
req.started = true
@@ -150,7 +151,7 @@ function mapError (err: any, production: boolean): Result {
150151
*/
151152
function finalhandler (req: Request) {
152153
return function () {
153-
return Promise.resolve(new Response(req, {
154+
return Promise.resolve(new Response({
154155
status: 404,
155156
body: `Cannot ${req.method} ${req.url}`
156157
}))

0 commit comments

Comments
 (0)