Skip to content

Commit

Permalink
test(http): add test that tests handling empty http method (questdb#4254
Browse files Browse the repository at this point in the history
)
  • Loading branch information
ideoma authored Feb 29, 2024
1 parent b001245 commit 2b72bf8
Showing 1 changed file with 32 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2708,6 +2708,38 @@ public void testImportWithSingleCharacterColumnName() throws Exception {
);
}

@Test
public void testInvalidRequestIsHandled() throws Exception {
new HttpQueryTestBuilder()
.withTempFolder(root)
.withWorkerCount(2)
.withHttpServerConfigBuilder(new HttpServerConfigurationBuilder())
.withTelemetry(false)
.run((engine) -> {
final String request = " /query?query=drop%20table%20x HTTP/1.1\r\n" +
"Host: localhost:9001\r\n" +
"Connection: keep-alive\r\n" +
"Cache-Control: max-age=0\r\n" +
"Upgrade-Insecure-Requests: 1\r\n" +
"User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36\r\n" +
"Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3\r\n" +
"Accept-Encoding: gzip, deflate, br\r\n" +
"Accept-Language: en-GB,en-US;q=0.9,en;q=0.8\r\n" +
"\r\n";
new SendAndReceiveRequestBuilder().execute(request,
"HTTP/1.1 400 Bad request\r\n" +
"Server: questDB/1.0\r\n" +
"Date: Thu, 1 Jan 1970 00:00:00 GMT\r\n" +
"Transfer-Encoding: chunked\r\n" +
"Content-Type: text/plain; charset=utf-8\r\n" +
"\r\n" +
"16\r\n" +
"Method not supported\r\n" +
"\r\n" +
"00\r\n");
});
}

@Test
public void testJsonImplicitCastException() throws Exception {
testJsonQuery(
Expand Down

0 comments on commit 2b72bf8

Please sign in to comment.