Skip to content

Commit 8b03cbf

Browse files
semantic-release-botyugasun
authored andcommitted
feat: remove event and context header
1 parent e6452a1 commit 8b03cbf

File tree

3 files changed

+4
-15
lines changed

3 files changed

+4
-15
lines changed

__tests__/integration.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ function makeEvent (eventOverrides) {
2424
function expectedRootResponse () {
2525
return makeResponse({
2626
'headers': {
27-
'content-length': '3446',
27+
'content-length': '3321',
2828
'content-type': 'text/html; charset=utf-8',
29-
'etag': 'W/"d76-UV3AoJfpe2/C0l+IRqFcasVbyD0"'
29+
'etag': 'W/"cf9-GYAvM/JE23lcw+qXvQGUeB9SXHg"'
3030
}
3131
})
3232
}

__tests__/unit.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,7 @@ test('mapApiGatewayEventToHttpRequest: with headers', () => {
7272
path: '/foo',
7373
headers: {
7474
'x-foo': 'foo',
75-
'Content-Length': Buffer.byteLength('Hello serverless!'),
76-
'x-apigateway-event': encodeURIComponent(JSON.stringify(r.eventClone)),
77-
'x-apigateway-context': encodeURIComponent(JSON.stringify(r.context))
75+
'Content-Length': Buffer.byteLength('Hello serverless!')
7876
},
7977
socketPath: '/tmp/server0.sock'
8078
})
@@ -87,9 +85,7 @@ test('mapApiGatewayEventToHttpRequest: without headers', () => {
8785
method: 'GET',
8886
path: '/foo',
8987
headers: {
90-
'Content-Length': Buffer.byteLength('Hello serverless!'),
91-
'x-apigateway-event': encodeURIComponent(JSON.stringify(r.eventClone)),
92-
'x-apigateway-context': encodeURIComponent(JSON.stringify(r.context))
88+
'Content-Length': Buffer.byteLength('Hello serverless!')
9389
},
9490
socketPath: '/tmp/server0.sock'
9591
})

src/index.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,11 @@ function mapApiGatewayEventToHttpRequest (event, context, socketPath) {
3535
const clonedEventWithoutBody = clone(event)
3636
delete clonedEventWithoutBody.body
3737

38-
headers['x-apigateway-event'] = encodeURIComponent(JSON.stringify(clonedEventWithoutBody))
39-
headers['x-apigateway-context'] = encodeURIComponent(JSON.stringify(context))
40-
4138
return {
4239
method: event.httpMethod,
4340
path: getPathWithQueryStringParams(event),
4441
headers,
4542
socketPath
46-
// protocol: `${headers['X-Forwarded-Proto']}:`,
47-
// host: headers.Host,
48-
// hostname: headers.Host, // Alias for host
49-
// port: headers['X-Forwarded-Port']
5043
}
5144
}
5245

0 commit comments

Comments
 (0)