| 165 | |
| 166 | |
| 167 | TEST_P(ResourceProviderManagerHttpApiTest, MalformedContent) |
| 168 | { |
| 169 | const ContentType contentType = GetParam(); |
| 170 | |
| 171 | http::Request request; |
| 172 | request.method = "POST"; |
| 173 | request.headers = createBasicAuthHeaders(DEFAULT_CREDENTIAL); |
| 174 | request.headers["Accept"] = stringify(contentType); |
| 175 | request.headers["Content-Type"] = stringify(contentType); |
| 176 | request.body = "MALFORMED_CONTENT"; |
| 177 | |
| 178 | ResourceProviderManager manager( |
| 179 | Registrar::create(Owned<Storage>(new InMemoryStorage)).get()); |
| 180 | |
| 181 | Future<http::Response> response = manager.api(request, None()); |
| 182 | |
| 183 | AWAIT_EXPECT_RESPONSE_STATUS_EQ(BadRequest().status, response); |
| 184 | switch (contentType) { |
| 185 | case ContentType::PROTOBUF: |
| 186 | AWAIT_EXPECT_RESPONSE_BODY_EQ( |
| 187 | "Failed to parse body into Call protobuf", |
| 188 | response); |
| 189 | break; |
| 190 | case ContentType::JSON: |
| 191 | AWAIT_EXPECT_RESPONSE_BODY_EQ( |
| 192 | "Failed to parse body into JSON: " |
| 193 | "syntax error at line 1 near: MALFORMED_CONTENT", |
| 194 | response); |
| 195 | break; |
| 196 | case ContentType::RECORDIO: |
| 197 | break; |
| 198 | } |
| 199 | } |
| 200 | |
| 201 | |
| 202 | // Confirm that the resource provider manager performs call validation |
nothing calls this directly
no test coverage detected