Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
markdroth committed Nov 11, 2024
1 parent 7750f1a commit 9294fe0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
12 changes: 8 additions & 4 deletions test/core/http/httpcli_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,10 @@ TEST_F(HttpRequestTest, Get) {
std::string host = absl::StrFormat("localhost:%d", g_server_port);
LOG(INFO) << "requesting from " << host;
memset(&req, 0, sizeof(req));
auto uri = grpc_core::URI::Create("http", host, "/get", {} /* query params */,
"" /* fragment */);
auto uri = grpc_core::URI::Create(
"http", host, "/get",
/*query_parameter_pairs=*/{{"foo", "bar"}, {"baz", "quux"}},
/*fragment=*/"");
CHECK(uri.ok());
grpc_core::OrphanablePtr<grpc_core::HttpRequest> http_request =
grpc_core::HttpRequest::Get(
Expand All @@ -219,8 +221,10 @@ TEST_F(HttpRequestTest, Post) {
memset(&req, 0, sizeof(req));
req.body = const_cast<char*>("hello");
req.body_length = 5;
auto uri = grpc_core::URI::Create("http", host, "/post",
{} /* query params */, "" /* fragment */);
auto uri = grpc_core::URI::Create(
"http", host, "/post",
/*query_parameter_pairs=*/{{"foo", "bar"}, {"mumble", "frotz"}},
/*fragment=*/"");
CHECK(uri.ok());
grpc_core::OrphanablePtr<grpc_core::HttpRequest> http_request =
grpc_core::HttpRequest::Post(
Expand Down
4 changes: 2 additions & 2 deletions test/core/http/test_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,13 @@ def good(self):
)

def do_GET(self):
if self.path == "/get":
if self.path == "/get?foo=bar&baz=quux":
self.good()

def do_POST(self):
content_len = self.headers.get("content-length")
content = self.rfile.read(int(content_len)).decode("ascii")
if self.path == "/post" and content == "hello":
if self.path == "/post?foo=bar&mumble=frotz" and content == "hello":
self.good()


Expand Down

0 comments on commit 9294fe0

Please sign in to comment.