INNER CODE UNIT · Go

testAPIGatewayLambda

mweagle/Sparta · apigateway_test.go:26

func testAPIGatewayLambda(ctx context.Context,
	gatewayEvent spartaAWSEvents.APIGatewayRequest) (interface{}, error) {
	logger, loggerOk := ctx.Value(ContextKeyLogger).(*zerolog.Logger)
	if loggerOk {
		logger.Info().Msg("Hello world structured log message")
	}

	// Return a message, together with the incoming input...
	return spartaAPIGateway.NewResponse(http.StatusOK, &testRequest{
		Message: fmt.Sprintf("Test %s", randVal),
		Request: gatewayEvent,
	}), nil
}

func TestAPIGatewayRequest(t *testing.T) {
	requestBody := &testRequest{
		Message: randVal,
	}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…