dherault / serverless-offline

Emulate AWS λ and API Gateway locally when developing your Serverless project
MIT License
5.19k stars 796 forks source link

fix: Allow string values in provider.apiGateway.apiKeys #1662

Closed andersem closed 8 months ago

andersem commented 1 year ago

Description

Fixes the problem where getApiKeysValues would only allow FIRST_API_KEY in the following config, and not SECOND_API_KEY because it's not an object.

provider:
  name: aws
  apiGateway:
    apiKeys:
      - name: FIRST_API_KEY_NAME
        value: FIRST_API_KEY
      - SECOND_API_KEY

Strings are supported, according to the serverless (docs)[https://www.serverless.com/framework/docs/providers/aws/guide/serverless.yml#api-gateway-v1-rest-api].

Motivation and Context

Fixes https://github.com/dherault/serverless-offline/issues/1661

How Has This Been Tested?

Tested with unit tests with both types of input

andersem commented 1 year ago

I guess there's a use case for API_KEYs that can be empty strings?

gangadharKorrapati commented 9 months ago

+1 support string x-api-keys

dnalborczyk commented 8 months ago

thank you @andersem !