mirror of
https://github.com/rclone/rclone.git
synced 2026-01-04 17:43:50 +00:00
fs rc: fixes incorrect Content-Type in HTTP API - fixes #7726
This commit is contained in:
committed by
Nick Craig-Wood
parent
5323a21898
commit
47cbddbd27
@@ -200,6 +200,7 @@ func (s *Server) Serve() error {
|
||||
func writeError(path string, in rc.Params, w http.ResponseWriter, err error, status int) {
|
||||
fs.Errorf(nil, "rc: %q: error: %v", path, err)
|
||||
params, status := rc.Error(path, in, err, status)
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
w.WriteHeader(status)
|
||||
err = rc.WriteJSON(w, params)
|
||||
if err != nil {
|
||||
@@ -294,6 +295,7 @@ func (s *Server) handlePost(w http.ResponseWriter, r *http.Request, path string)
|
||||
}
|
||||
|
||||
fs.Debugf(nil, "rc: %q: reply %+v: %v", path, out, err)
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
err = rc.WriteJSON(w, out)
|
||||
if err != nil {
|
||||
// can't return the error at this point - but have a go anyway
|
||||
|
||||
Reference in New Issue
Block a user