Go로 AWS Lambda 설정 중 API Gateway 설정을 하여도 CORS 오류가 발생하여 headers 설정하여 해결

func main() {
    lambda.Start(handler)
}

func handler(ctx context.Context, request events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) {
    headers := map[string]string{
        "Access-Control-Allow-Origin":  "*",
        "Access-Control-Allow-Headers": "Content-Type",
    }

    return events.APIGatewayProxyResponse{
        Headers:    headers,
        Body:       "Hello, World!",
        StatusCode: 200,
    }, nil

		// or

		return events.APIGatewayProxyResponse{
			StatusCode: 200,
			Body:       responseBody,
			Headers: map[string]string{
				"Access-Control-Allow-Origin": "*",
			},
		}, nil
}