mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-26 20:01:02 +00:00
Merge pull request #864 from Bugagazavr/json_response
Response as JSON instead plain text
This commit is contained in:
commit
22fa37c3f1
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