#130: Added error validation for app creator
This commit is contained in:
@@ -5458,7 +5458,7 @@ func echoOpenapiData(resp http.ResponseWriter, request *http.Request) {
|
||||
if err != nil {
|
||||
log.Printf("Api authentication failed in validate swagger: %s", err)
|
||||
resp.WriteHeader(401)
|
||||
resp.Write([]byte(`{"success": false}`))
|
||||
resp.Write([]byte(`{"success": false, "reason": "Failed authentication"}`))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -5504,6 +5504,12 @@ func echoOpenapiData(resp http.ResponseWriter, request *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
if newresp.StatusCode >= 400 {
|
||||
resp.WriteHeader(201)
|
||||
resp.Write([]byte(fmt.Sprintf(`{"success": false, "reason": "%s"}`, urlbody)))
|
||||
return
|
||||
}
|
||||
|
||||
resp.WriteHeader(200)
|
||||
resp.Write(urlbody)
|
||||
}
|
||||
@@ -5734,6 +5740,8 @@ func validateSwagger(resp http.ResponseWriter, request *http.Request) {
|
||||
err = gyaml.Unmarshal(body, &swagger)
|
||||
if err != nil {
|
||||
log.Printf("Yaml error: %s", err)
|
||||
} else {
|
||||
log.Printf("Found valid yaml!")
|
||||
}
|
||||
|
||||
resp.WriteHeader(422)
|
||||
|
||||
Reference in New Issue
Block a user