dherault / serverless-offline

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

Add the headers passed via the event callback to the response #1736

Closed apokryfos closed 3 months ago

apokryfos commented 10 months ago

Add the headers passed via the event callback to the response to match the behaviour of the Application Load Balancer event.

Description

The headers of the ALB event response are not currently passed via the serverless offline alb http server.

Motivation and Context

Fixes issues with code like below:


callback(null, {
    statusCode: 302,
    headers: {
       Location: url
    }
});

previously the above code with generate a redirect response without the Location header included which did not result in any redirection happening.

How Has This Been Tested?

I've testeded locally in the application that first presented this issue and it seems to work. Did not do any other testing myself.

apokryfos commented 3 months ago

I think this resolves #1728

apokryfos commented 3 months ago

Turns out https://github.com/dherault/serverless-offline/pull/1756 also solves this issue and includes tests so I think that would be a better PR to merge for this