Commit 132cdb87 authored by Michael Hanselmann's avatar Michael Hanselmann

rapi: Re-add “/2” resource

Like “/”, it'll just return a JSON null.
Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
Reviewed-by: default avatarRené Nussbaumer <rn@google.com>
parent 97f8e7f0
......@@ -242,6 +242,11 @@ Resources
The root resource. Has no function, but for legacy reasons the ``GET``
method is supported.
``/2``
++++++
Has no function, but for legacy reasons the ``GET`` method is supported.
``/2/info``
+++++++++++
......
......@@ -100,6 +100,7 @@ def GetHandlers(node_name_pattern, instance_name_pattern,
# API.
return {
"/": rlib2.R_root,
"/2": rlib2.R_2,
"/version": rlib2.R_version,
......
......@@ -161,6 +161,12 @@ class R_root(baserlib.ResourceBase):
return None
class R_2(R_root):
"""/2 resource.
"""
class R_version(baserlib.ResourceBase):
"""/version resource.
......
......@@ -142,7 +142,7 @@ class TestDocs(unittest.TestCase):
prevline = line
prefix_exception = frozenset(["/", "/version"])
prefix_exception = frozenset(["/", "/version", "/2"])
undocumented = []
used_uris = []
......
......@@ -1645,9 +1645,10 @@ class TestSimpleResources(unittest.TestCase):
handler = _CreateHandler(rlib2.R_2_features, [], {}, None, self.clfactory)
self.assertEqual(set(handler.GET()), rlib2.ALL_FEATURES)
def testRoot(self):
handler = _CreateHandler(rlib2.R_root, [], {}, None, self.clfactory)
self.assertTrue(handler.GET() is None)
def testEmpty(self):
for cls in [rlib2.R_root, rlib2.R_2]:
handler = _CreateHandler(cls, [], {}, None, self.clfactory)
self.assertTrue(handler.GET() is None)
def testVersion(self):
handler = _CreateHandler(rlib2.R_version, [], {}, None, self.clfactory)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment