BuildJSONPayload builds the standard JSON payload used by function terminal responses.
(code int, message string)
| 6 | |
| 7 | // BuildJSONPayload builds the standard JSON payload used by function terminal responses. |
| 8 | func BuildJSONPayload(code int, message string) []byte { |
| 9 | if code >= 400 && code < 600 { |
| 10 | bs, _ := json.Marshal(struct { |
| 11 | Status int `json:"status"` |
| 12 | ErrorMessage string `json:"errorMessage"` |
| 13 | }{ |
| 14 | Status: code, |
| 15 | ErrorMessage: message, |
| 16 | }) |
| 17 | return bs |
| 18 | } |
| 19 | |
| 20 | bs, _ := json.Marshal(struct { |
| 21 | Status int `json:"status"` |
| 22 | Message string `json:"message"` |
| 23 | }{ |
| 24 | Status: code, |
| 25 | Message: message, |
| 26 | }) |
| 27 | return bs |
| 28 | } |
no outgoing calls
searching dependent graphs…