]> granicus.if.org Git - pdns/commitdiff
webserver: fix zone list to not have a root element
authorChristian Hofstaedtler <christian@hofstaedtler.name>
Tue, 28 Jan 2014 00:03:25 +0000 (01:03 +0100)
committerChristian Hofstaedtler <christian@hofstaedtler.name>
Tue, 28 Jan 2014 08:55:25 +0000 (09:55 +0100)
Per the specification.

pdns/ws.cc
regression-tests.api/test_Zones.py

index 20855ad704ffbc54e2d2f84512c20c2f895eca43..ef5f088bc553953f5dc410c9ac7f61361f3594af 100644 (file)
@@ -555,10 +555,7 @@ static void apiServerZones(HttpRequest* req, HttpResponse* resp) {
   B.getAllDomains(&domains);
 
   Document doc;
-  doc.SetObject();
-
-  Value jdomains;
-  jdomains.SetArray();
+  doc.SetArray();
 
   BOOST_FOREACH(const DomainInfo& di, domains) {
     Value jdi;
@@ -580,9 +577,8 @@ static void apiServerZones(HttpRequest* req, HttpResponse* resp) {
     jdi.AddMember("serial", di.serial, doc.GetAllocator());
     jdi.AddMember("notified_serial", di.notified_serial, doc.GetAllocator());
     jdi.AddMember("last_check", (unsigned int) di.last_check, doc.GetAllocator());
-    jdomains.PushBack(jdi, doc.GetAllocator());
+    doc.PushBack(jdi, doc.GetAllocator());
   }
-  doc.AddMember("domains", jdomains, doc.GetAllocator());
   resp->body = makeStringFromDocument(doc);
 }
 
index 4bc961074b09aa114daf4959e6c3ff0e8b9a7da8..c63a1215d6f8975b25bb453e2841befa72a89492 100644 (file)
@@ -9,9 +9,7 @@ class Servers(ApiTestCase):
     def test_ListZones(self):
         r = self.session.get(self.url("/servers/localhost/zones"))
         self.assertSuccessJson(r)
-        data = r.json()
-        self.assertIn('domains', data)
-        domains = data['domains']
+        domains = r.json()
         example_com = [domain for domain in domains if domain['name'] == u'example.com']
         self.assertEquals(len(example_com), 1)
         example_com = example_com[0]