diff --git a/src/common/api/base.go b/src/common/api/base.go index bb1750a56..928c37e08 100644 --- a/src/common/api/base.go +++ b/src/common/api/base.go @@ -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) } diff --git a/src/core/api/robot.go b/src/core/api/robot.go index be49983a4..870310e71 100644 --- a/src/core/api/robot.go +++ b/src/core/api/robot.go @@ -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()