refactored

Signed-off-by: gklp <gokalpkuscu@gmail.com>
This commit is contained in:
gklp 2019-08-26 14:15:03 +03:00
parent 44a9e5d127
commit dee3defeff
2 changed files with 4 additions and 1 deletions
src
common/api
core/api

View File

@ -112,7 +112,6 @@ func (b *BaseAPI) Redirect(statusCode int, resouceID string) {
requestURI := b.Ctx.Request.RequestURI
resourceURI := requestURI + "/" + resouceID
b.Ctx.ResponseWriter.Header().Set("Content-Type", "application/json")
b.Ctx.Redirect(statusCode, resourceURI)
}

View File

@ -161,6 +161,10 @@ func (r *RobotAPI) Post() {
Name: robot.Name,
Token: rawTk,
}
w := r.Ctx.ResponseWriter
w.Header().Set("Content-Type", "application/json")
r.Redirect(http.StatusCreated, strconv.FormatInt(id, 10))
r.Data["json"] = robotRep
r.ServeJSON()