File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed
Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -48,7 +48,8 @@ static hash_cptr to_hash(const std::string_view& token) NOEXCEPT
4848
4949code parse_target (request_t & out, const std::string_view& path) NOEXCEPT
5050{
51- if (path.empty ())
51+ const auto clean = split (path, " ?" , false , false ).front ();
52+ if (clean.empty ())
5253 return error::empty_path;
5354
5455 // Avoid conflict with node type.
@@ -65,7 +66,7 @@ code parse_target(request_t& out, const std::string_view& path) NOEXCEPT
6566
6667 auto & method = out.method ;
6768 auto & params = std::get<object_t >(out.params .value ());
68- const auto segments = split (path , " /" , false , true );
69+ const auto segments = split (clean , " /" , false , true );
6970 BC_ASSERT (!segments.empty ());
7071
7172 size_t segment{};
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ using object_t = network::rpc::object_t;
2929BOOST_AUTO_TEST_CASE (parse__parse_target__empty_path__empty_path)
3030{
3131 request_t out{};
32- BOOST_REQUIRE_EQUAL (parse_target (out, " " ), node::error::empty_path);
32+ BOOST_REQUIRE_EQUAL (parse_target (out, " ?foo=bar " ), node::error::empty_path);
3333}
3434
3535BOOST_AUTO_TEST_CASE (parse__parse_target__missing_version__missing_version)
@@ -67,7 +67,7 @@ BOOST_AUTO_TEST_CASE(parse__parse_target__invalid_target__invalid_target)
6767
6868BOOST_AUTO_TEST_CASE (parse__parse_target__block_hash_valid__expected)
6969{
70- const std::string path = " //v42//block//hash//0000000000000000000000000000000000000000000000000000000000000042//" ;
70+ const std::string path = " //v42//block//hash//0000000000000000000000000000000000000000000000000000000000000042//?foo=bar " ;
7171
7272 request_t request{};
7373 BOOST_REQUIRE (!parse_target (request, path));
You can’t perform that action at this time.
0 commit comments