Changes related mainly to status codes
This commit is contained in:
@@ -37,15 +37,16 @@ func main() {
|
||||
|
||||
func Handler() (events.APIGatewayProxyResponse, error) {
|
||||
// Getting JSON as []byte
|
||||
b, err := convertTasksToJSON()
|
||||
if err != nil {
|
||||
fmt.Println("error:", err)
|
||||
b, err := convertTasksToJSON()
|
||||
status := 200
|
||||
if err != nil {
|
||||
status = 500
|
||||
}
|
||||
|
||||
return events.APIGatewayProxyResponse {
|
||||
Body: string(b[:]),
|
||||
StatusCode: 200,
|
||||
}, nil
|
||||
StatusCode: status,
|
||||
}, err
|
||||
}
|
||||
|
||||
func convertTasksToJSON() ([]byte, error) {
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user