INNER CODE UNIT · Go
methodResponses
mweagle/Sparta · apigateway.go:94
func methodResponses(api *API, userResponses map[int]*Response, corsEnabled bool) []gofapig.Method_MethodResponse {
var responses []gofapig.Method_MethodResponse
for eachHTTPStatusCode, eachResponse := range userResponses {
methodResponseParams := eachResponse.Parameters
if corsEnabled {
for eachString, eachBool := range corsMethodResponseParams(api) {
methodResponseParams[eachString] = eachBool
}
}
// Then transform them all to strings because internet
methodResponse := gofapig.Method_MethodResponse{
StatusCode: strconv.Itoa(eachHTTPStatusCode),
}
if len(methodResponseParams) != 0 {
methodResponse.ResponseParameters = methodResponseParams
}
responses = append(responses, methodResponse)