This test sends a malformed body that cannot be deserialized into a valid protobuf resulting in a BadRequest.
| 190 | // This test sends a malformed body that cannot be deserialized |
| 191 | // into a valid protobuf resulting in a BadRequest. |
| 192 | TEST_P(SchedulerHttpApiTest, MalformedContent) |
| 193 | { |
| 194 | Try<Owned<cluster::Master>> master = StartMaster(); |
| 195 | ASSERT_SOME(master); |
| 196 | |
| 197 | const string body = "MALFORMED_CONTENT"; |
| 198 | |
| 199 | const string contentType = GetParam(); |
| 200 | |
| 201 | process::http::Headers headers = createBasicAuthHeaders(DEFAULT_CREDENTIAL); |
| 202 | headers["Accept"] = contentType; |
| 203 | |
| 204 | Future<Response> response = process::http::post( |
| 205 | master.get()->pid, |
| 206 | "api/v1/scheduler", |
| 207 | headers, |
| 208 | body, |
| 209 | contentType); |
| 210 | |
| 211 | AWAIT_EXPECT_RESPONSE_STATUS_EQ(BadRequest().status, response); |
| 212 | } |
| 213 | |
| 214 | |
| 215 | // This test sets an unsupported media type as Content-Type. This |
nothing calls this directly
no test coverage detected