Closed iNDicat0r closed 7 years ago
It's not yet supported by this example, I will make a pull request that adds support for it.
Awesome, will be waiting to see it!
I'm working on it at https://github.com/cristim/serverless-golang/tree/aws-lambda-go-shim, still not ready yet, the header is somehow lost, likely filtered by the API Gateway
My understanding is that the lambda response to the API gateway should contain the header value. In nodejs its set using the context object, however if i understood correctly the go binary gets the event object as stdin and does return the final value of the object as the stdout.
This sounds like the context should be set within the python environment..
@fsenart replied this and said it should work:
You have to send headers before writing the first ever byte in body so exchange the two lines and it should be ok
I've merged PR #3 for now and will look at making both lambda-go-shim
and lambda-go-net
available in the same project in the future.
I think this can be closed, extending the example to a multi-function configuration should be tracked in a new issue.
Thanks @cristim. Will close this for now if everyone is happy. Would like provide an example for custom header using go-shim
context but will do this as separate ticket. #4 perhaps.
@fsenart, are you aware of any issues with the context
objects?
@cristim no! @yunspace can you please explain me what is the problem you encounter with the context?
hi @fsenart sorry for the confusion, the issue is to provide an example of setting custom header using context
rather than context
not working. My bad, I have re-phrased.
FYI custom headers can also be set via go lambda events instead of go lambda net: https://github.com/yunspace/serverless-golang/blob/master/aws/event/event_handler.go#L16
Hi
How can i set a custom header within the golang runtime?
Regards