-
Notifications
You must be signed in to change notification settings - Fork 1
/
events.go
49 lines (41 loc) · 1.21 KB
/
events.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package websocket
import (
"net/http"
"github.com/aws/aws-lambda-go/events"
)
func InternalServerErrorResponse() events.APIGatewayProxyResponse {
return events.APIGatewayProxyResponse{
StatusCode: http.StatusInternalServerError,
}
}
func BadRequestResponse() events.APIGatewayProxyResponse {
return events.APIGatewayProxyResponse{
StatusCode: http.StatusBadRequest,
}
}
func OkResponse() events.APIGatewayProxyResponse {
return events.APIGatewayProxyResponse{
StatusCode: http.StatusOK,
}
}
func HTTPInternalServerErrorResponse() events.APIGatewayV2HTTPResponse {
return events.APIGatewayV2HTTPResponse{
StatusCode: http.StatusInternalServerError,
Body: `{"code": 500, "message": "Internal Server Error"}`,
IsBase64Encoded: false,
}
}
func HTTPBadRequestResponse() events.APIGatewayV2HTTPResponse {
return events.APIGatewayV2HTTPResponse{
StatusCode: http.StatusBadRequest,
Body: `{"code": 400, "message": "Bad Request"}`,
IsBase64Encoded: false,
}
}
func HTTPOKResponse() events.APIGatewayV2HTTPResponse {
return events.APIGatewayV2HTTPResponse{
StatusCode: http.StatusOK,
Body: `{"code": 200, "message": "OK"}`,
IsBase64Encoded: false,
}
}