mirror of
https://github.com/LBRYFoundation/tracker.git
synced 2025-08-28 16:01:32 +00:00
Use a constant for the JSON Content-Type
This commit is contained in:
parent
d39a40c4fe
commit
df5ad919f9
1 changed files with 4 additions and 2 deletions
|
@ -16,6 +16,8 @@ import (
|
||||||
"github.com/chihaya/chihaya/models"
|
"github.com/chihaya/chihaya/models"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const jsonContentType = "application/json; charset=UTF-8"
|
||||||
|
|
||||||
func (t *Tracker) check(w http.ResponseWriter, r *http.Request, p httprouter.Params) (int, error) {
|
func (t *Tracker) check(w http.ResponseWriter, r *http.Request, p httprouter.Params) (int, error) {
|
||||||
_, err := w.Write([]byte("An easter egg goes here."))
|
_, err := w.Write([]byte("An easter egg goes here."))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -43,7 +45,7 @@ func (t *Tracker) getTorrent(w http.ResponseWriter, r *http.Request, p httproute
|
||||||
return http.StatusInternalServerError, err
|
return http.StatusInternalServerError, err
|
||||||
}
|
}
|
||||||
|
|
||||||
w.Header().Set("Content-Type", "application/json; charset=UTF-8")
|
w.Header().Set("Content-Type", jsonContentType)
|
||||||
e := json.NewEncoder(w)
|
e := json.NewEncoder(w)
|
||||||
err = e.Encode(torrent)
|
err = e.Encode(torrent)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -112,7 +114,7 @@ func (t *Tracker) getUser(w http.ResponseWriter, r *http.Request, p httprouter.P
|
||||||
return http.StatusInternalServerError, err
|
return http.StatusInternalServerError, err
|
||||||
}
|
}
|
||||||
|
|
||||||
w.Header().Set("Content-Type", "application/json; charset=UTF-8")
|
w.Header().Set("Content-Type", jsonContentType)
|
||||||
e := json.NewEncoder(w)
|
e := json.NewEncoder(w)
|
||||||
err = e.Encode(user)
|
err = e.Encode(user)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Add table
Reference in a new issue