From 19444c763fe5e4a26ec2c38b2fbd5a03709c42c0 Mon Sep 17 00:00:00 2001 From: ayame-git Date: Thu, 11 May 2017 06:41:09 +0300 Subject: [PATCH] correct? status codes --- router/apiHandler.go | 2 +- service/api/api.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/router/apiHandler.go b/router/apiHandler.go index 557fa5c0..0f684915 100644 --- a/router/apiHandler.go +++ b/router/apiHandler.go @@ -97,7 +97,7 @@ func ApiViewHandler(w http.ResponseWriter, r *http.Request) { func ApiUploadHandler(w http.ResponseWriter, r *http.Request) { if config.UploadsDisabled { - http.Error(w, "Error uploads are disabled", http.StatusInternalServerError) + http.Error(w, "Error uploads are disabled", http.StatusBadRequest) return } diff --git a/service/api/api.go b/service/api/api.go index 78740bb8..3736031c 100644 --- a/service/api/api.go +++ b/service/api/api.go @@ -146,11 +146,11 @@ func (r *TorrentRequest) ValidateMultipartUpload(req *http.Request) (int64, erro } // check a few things if torrent.IsPrivate() { - return 0, errors.New("private torrents not allowed"), http.StatusBadRequest + return 0, errors.New("private torrents not allowed"), http.StatusNotAcceptable } trackers := torrent.GetAllAnnounceURLS() if !uploadService.CheckTrackers(trackers) { - return 0, errors.New("tracker(s) not allowed"), http.StatusBadRequest + return 0, errors.New("tracker(s) not allowed"), http.StatusNotAcceptable } if r.Name == "" { r.Name = torrent.TorrentName()