put error status

This commit is contained in:
ycc 2022-05-18 17:47:42 +02:00
parent f1310a3a54
commit 3010940db6
3 changed files with 5 additions and 2 deletions

View File

@ -12,4 +12,5 @@ Running in debug mode
Testing Testing
------- -------
http://localhost:8080/swagger http://localhost:8080/swagger

View File

@ -55,9 +55,11 @@ func (t *TableController) Put() {
uid, err := db.Table(table).UpdateOrInsert(data) uid, err := db.Table(table).UpdateOrInsert(data)
if err != nil { if err != nil {
log.Error().Msg(err.Error()) log.Error().Msg(err.Error())
t.Ctx.Output.SetStatus(http.StatusBadRequest)
} else {
t.Ctx.Output.SetStatus(http.StatusOK)
} }
t.Data["json"] = map[string]int{"uid": uid} t.Data["json"] = map[string]int{"uid": uid}
t.Ctx.Output.SetStatus(http.StatusOK)
t.ServeJSON() t.ServeJSON()
} }

BIN
sqldb-ws Executable file

Binary file not shown.