Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add support for GETS alias for GET requests

  • Loading branch information...
commit 8052c3f128bd3dba11d5020adbadd621954dbaa8 1 parent f1ce730
@cjc cjc authored
Showing with 13 additions and 1 deletion.
  1. +1 −1  src/net/request.cpp
  2. +12 −0 tests/request.cpp
View
2  src/net/request.cpp
@@ -44,7 +44,7 @@ request_grammar::request_grammar()
>> qi::uint_ [phoenix::ref(req.wait_ms) = qi::_1]
);
- get = lit("get ") [phoenix::ref(req.type) = request::RT_GET]
+ get = (lit("get ")|lit("gets ")) [phoenix::ref(req.type) = request::RT_GET]
>> key_name [phoenix::ref(req.queue) = qi::_1]
>> *get_option;
View
12 tests/request.cpp
@@ -46,6 +46,18 @@ BOOST_FIXTURE_TEST_CASE( test_get, fixtures::basic_request )
BOOST_REQUIRE_EQUAL(request_.wait_ms, 500);
}
+// test that we get some options correctly for a gets
+BOOST_FIXTURE_TEST_CASE( test_gets, fixtures::basic_request )
+{
+ BOOST_REQUIRE(parser_.parse(request_, string("gets bar+woof/t=700/close/open\r\n")));
+ BOOST_REQUIRE_EQUAL(request_.type, darner::request::RT_GET);
+ BOOST_REQUIRE_EQUAL(request_.queue, "bar+woof");
+ BOOST_REQUIRE(request_.get_open);
+ BOOST_REQUIRE(request_.get_close);
+ BOOST_REQUIRE(!request_.get_abort);
+ BOOST_REQUIRE_EQUAL(request_.wait_ms, 700);
+}
+
// test that reparsing clears fields that were previously set
BOOST_FIXTURE_TEST_CASE( test_reparse, fixtures::basic_request )
{
Please sign in to comment.
Something went wrong with that request. Please try again.