mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-27 04:11:03 +00:00
Response as JSON instead plain text
This commit is contained in:
parent
2f76696226
commit
a354aabbb0
4 changed files with 7 additions and 0 deletions
|
@ -113,6 +113,8 @@ func GetCC(c web.C, w http.ResponseWriter, r *http.Request) {
|
|||
name = c.URLParams["name"]
|
||||
)
|
||||
|
||||
w.Header().Set("Content-Type", "application/xml")
|
||||
|
||||
repo, err := datastore.GetRepoName(ctx, host, owner, name)
|
||||
if err != nil {
|
||||
w.WriteHeader(http.StatusNotFound)
|
||||
|
|
|
@ -30,6 +30,8 @@ func GetLogin(c web.C, w http.ResponseWriter, r *http.Request) {
|
|||
return
|
||||
}
|
||||
|
||||
w.Header().Del("Content-Type")
|
||||
|
||||
// authenticate the user
|
||||
login, err := remote.Authorize(w, r)
|
||||
if err != nil {
|
||||
|
|
|
@ -24,6 +24,8 @@ func GetOutput(c web.C, w http.ResponseWriter, r *http.Request) {
|
|||
hash = c.URLParams["commit"]
|
||||
)
|
||||
|
||||
w.Header().Set("Content-Type", "text/plain")
|
||||
|
||||
path := filepath.Join(host, owner, name, branch, hash)
|
||||
rc, err := blobstore.GetReader(ctx, path)
|
||||
if err != nil {
|
||||
|
|
|
@ -15,6 +15,7 @@ func Options(c *web.C, h http.Handler) http.Handler {
|
|||
w.Header().Set("Access-Control-Allow-Methods", "GET,POST,PUT,DELETE,OPTIONS")
|
||||
w.Header().Set("Access-Control-Allow-Headers", "Authorization")
|
||||
w.Header().Set("Allow", "HEAD,GET,POST,PUT,DELETE,OPTIONS")
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
w.WriteHeader(http.StatusOK)
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue