diff --git a/src/adapters/aws/api-gateway-v1.adapter.ts b/src/adapters/aws/api-gateway-v1.adapter.ts index 5cd35665..0af4dde8 100644 --- a/src/adapters/aws/api-gateway-v1.adapter.ts +++ b/src/adapters/aws/api-gateway-v1.adapter.ts @@ -11,6 +11,7 @@ import { import { getDefaultIfUndefined, getEventBodyAsBuffer, + getFlattenedHeadersMap, getMultiValueHeadersMap, getPathWithQueryStringParams, } from '../../core'; @@ -87,8 +88,8 @@ export class ApiGatewayV1Adapter partialEventV1.version !== '2.0' && partialEventV1.headers && partialEventV1.multiValueHeaders && - (partialEventV1.queryStringParameters === - partialEventV1.multiValueQueryStringParameters || + ((partialEventV1.queryStringParameters === null && + partialEventV1.multiValueQueryStringParameters === null) || (partialEventV1.queryStringParameters && partialEventV1.multiValueQueryStringParameters)) ); @@ -99,7 +100,7 @@ export class ApiGatewayV1Adapter */ public getRequest(event: APIGatewayProxyEvent): AdapterRequest { const method = event.httpMethod; - const headers = event.headers; + const headers = getFlattenedHeadersMap(event.headers, ',', true); const path = this.getPathFromEvent(event); let body: Buffer | undefined; diff --git a/test/adapters/aws/api-gateway-v1.adapter.spec.ts b/test/adapters/aws/api-gateway-v1.adapter.spec.ts index 021d2edf..b47e3099 100644 --- a/test/adapters/aws/api-gateway-v1.adapter.spec.ts +++ b/test/adapters/aws/api-gateway-v1.adapter.spec.ts @@ -42,6 +42,8 @@ describe(ApiGatewayV1Adapter.name, () => { expect(result).toHaveProperty('method', method); expect(result).toHaveProperty('headers'); + expect(result.headers).not.toHaveProperty('Accept'); + expect(result.headers).toHaveProperty('accept'); expect(result).toHaveProperty('body'); expect(result.body).toBeInstanceOf(Buffer);