1
0
mirror of https://github.com/rclone/rclone.git synced 2025-12-16 00:04:40 +00:00

rc: add NeedsRequest to call.

This commit is contained in:
Chaitanya
2020-06-05 19:56:46 +05:30
committed by Nick Craig-Wood
parent 2121c0fa23
commit d0de39ebcd
3 changed files with 11 additions and 5 deletions

View File

@@ -248,7 +248,6 @@ func (s *Server) handlePost(w http.ResponseWriter, r *http.Request, path string)
return
}
}
// Find the call
call := rc.Calls.Get(path)
if call == nil {
@@ -261,6 +260,10 @@ func (s *Server) handlePost(w http.ResponseWriter, r *http.Request, path string)
writeError(path, in, w, errors.Errorf("authentication must be set up on the rc server to use %q or the --rc-no-auth flag must be in use", path), http.StatusForbidden)
return
}
if call.NeedsRequest {
// Add the request to RC
in["_request"] = r
}
// Check to see if it is async or not
isAsync, err := in.GetBool("_async")