Added validation of scheduler::Call inside /call handler.
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/3544df75 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/3544df75 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/3544df75 Branch: refs/heads/master Commit: 3544df75639fe2d855c6d01e77b88bbe6f74d8fb Parents: 8e4d1c6 Author: Benjamin Mahler <[email protected]> Authored: Tue Aug 4 13:49:10 2015 -0700 Committer: Benjamin Mahler <[email protected]> Committed: Tue Aug 4 14:03:57 2015 -0700 ---------------------------------------------------------------------- src/master/http.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/3544df75/src/master/http.cpp ---------------------------------------------------------------------- diff --git a/src/master/http.cpp b/src/master/http.cpp index 32e8a23..76e7080 100644 --- a/src/master/http.cpp +++ b/src/master/http.cpp @@ -52,6 +52,7 @@ #include "logging/logging.hpp" #include "master/master.hpp" +#include "master/validation.hpp" #include "mesos/mesos.hpp" #include "mesos/resources.hpp" @@ -357,6 +358,13 @@ Future<Response> Master::Http::call(const Request& request) const APPLICATION_JSON + " or " + APPLICATION_PROTOBUF); } + Option<Error> error = validation::scheduler::call::validate(call); + + if (error.isSome()) { + return BadRequest("Failed to validate Scheduler::Call: " + + error.get().message); + } + // Default to sending back JSON. ContentType responseContentType = ContentType::JSON;
