Skip to content

Commit d354ee4

Browse files
committed
Add support for 206 response with its relevant headers + add Accept-Ranges in general. prompt version to 2.2.1
1 parent 426eb01 commit d354ee4

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

lib/apiGateway/methods.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ module.exports = {
1010
ResponseModels: {},
1111
StatusCode: 200
1212
},
13+
{
14+
ResponseParameters: {},
15+
ResponseModels: {},
16+
StatusCode: 206
17+
},
1318
{
1419
ResponseParameters: {},
1520
ResponseModels: {},

lib/package/s3/compileMethodsToS3.js

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,9 @@ module.exports = {
8888
getIntegrationRequestParameters(http) {
8989
switch (http.action) {
9090
case 'GetObject':
91-
return {}
91+
return {
92+
'integration.request.header.Range': 'method.request.header.Range'
93+
}
9294
case 'PutObject':
9395
return {
9496
'integration.request.header.x-amz-acl': "'authenticated-read'",
@@ -104,7 +106,11 @@ module.exports = {
104106
case 'GetObject':
105107
return {
106108
'method.response.header.content-type': 'integration.response.header.content-type',
107-
'method.response.header.Content-Type': 'integration.response.header.Content-Type'
109+
'method.response.header.Content-Type': 'integration.response.header.Content-Type',
110+
'method.response.header.accept-ranges': 'integration.response.header.accept-ranges',
111+
'method.response.header.Accept-Ranges': 'integration.response.header.Accept-Ranges',
112+
'method.response.header.content-range': 'integration.response.header.content-range',
113+
'method.response.header.Content-Range': 'integration.response.header.Content-Range'
108114
}
109115
case 'PutObject':
110116
return {
@@ -187,7 +193,13 @@ module.exports = {
187193
},
188194
{
189195
StatusCode: 200,
190-
SelectionPattern: '2\\d{2}',
196+
SelectionPattern: '2(?!06)\\d{2}',
197+
ResponseParameters: responseParams,
198+
ResponseTemplates: this.getS3IntegrationResponseTemplate(http, 'success')
199+
},
200+
{
201+
StatusCode: 206,
202+
SelectionPattern: '206',
191203
ResponseParameters: responseParams,
192204
ResponseTemplates: this.getS3IntegrationResponseTemplate(http, 'success')
193205
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "serverless-apigateway-service-proxy",
3-
"version": "2.2.0",
3+
"version": "2.2.1",
44
"description": "The Serverless Framework plugin for supporting AWS service proxy integration of API Gateway",
55
"main": "lib/index.js",
66
"scripts": {

0 commit comments

Comments
 (0)