Merge pull request #8440 from gklp/gklp_issue_8197_wrong_header_content_type_after_redirection

All redirect operations should have content-type as json
This commit is contained in:
Daniel Jiang 2019-09-20 17:21:01 +08:00 committed by GitHub
commit f491061b57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -155,6 +155,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()