From: Christian Hofstaedtler Date: Tue, 28 Jan 2014 00:03:25 +0000 (+0100) Subject: webserver: fix zone list to not have a root element X-Git-Tag: rec-3.6.0-rc1~213^2~13 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=45de629001efc3431ed0a1b257057b73dba37128;p=pdns webserver: fix zone list to not have a root element Per the specification. --- diff --git a/pdns/ws.cc b/pdns/ws.cc index 20855ad70..ef5f088bc 100644 --- a/pdns/ws.cc +++ b/pdns/ws.cc @@ -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); } diff --git a/regression-tests.api/test_Zones.py b/regression-tests.api/test_Zones.py index 4bc961074..c63a1215d 100644 --- a/regression-tests.api/test_Zones.py +++ b/regression-tests.api/test_Zones.py @@ -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]