From f0f47467b6d9a2b8c51b08186196b9bdf9655632 Mon Sep 17 00:00:00 2001 From: Benoit Lavenier <benoit.lavenier@e-is.pro> Date: Mon, 15 May 2023 16:22:48 +0200 Subject: [PATCH] Simplify read of ?pubkey query param, in /wot/requirements/:search --- app/modules/bma/lib/controllers/wot.ts | 2 +- test/integration/identity/identity-test.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/modules/bma/lib/controllers/wot.ts b/app/modules/bma/lib/controllers/wot.ts index 43c6e1e97..d408c3a61 100644 --- a/app/modules/bma/lib/controllers/wot.ts +++ b/app/modules/bma/lib/controllers/wot.ts @@ -188,7 +188,7 @@ export class WOTBinding extends AbstractController { async requirements(req: any): Promise<HttpRequirements> { const search = await ParametersService.getSearchP(req); let identities: any = []; - if (req.query?.pubkey === true || req.query?.pubkey === "true") { + if (req.query.pubkey) { identities = await this.IdentityService.searchIdentitiesByPubkey(search); } else { diff --git a/test/integration/identity/identity-test.ts b/test/integration/identity/identity-test.ts index 708ba15f2..2a60a7ffb 100644 --- a/test/integration/identity/identity-test.ts +++ b/test/integration/identity/identity-test.ts @@ -292,7 +292,7 @@ describe("Identities collision", function() { }); it('requirements by pubkey of cat', function() { - return expectAnswer(rp('http://127.0.0.1:7799/wot/requirements/HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd?pubkey=true', { json: true }), function(res:HttpRequirements) { + return expectAnswer(rp('http://127.0.0.1:7799/wot/requirements/HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd?pubkey', { json: true }), function(res:HttpRequirements) { res.should.have.property('identities').be.an.Array; res.should.have.property('identities').have.length(1); res.identities[0].should.have.property('pubkey').equal('HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd'); @@ -309,7 +309,7 @@ describe("Identities collision", function() { }); it('requirements by pubkey of man1', function() { - return expectAnswer(rp('http://127.0.0.1:7799/wot/requirements/12AbjvYY5hxV4v2KrN9pnGzgFxogwrzgYyncYHHsyFDK?pubkey=true', { json: true }), function(res:HttpRequirements) { + return expectAnswer(rp('http://127.0.0.1:7799/wot/requirements/12AbjvYY5hxV4v2KrN9pnGzgFxogwrzgYyncYHHsyFDK?pubkey', { json: true }), function(res:HttpRequirements) { res.should.have.property('identities').be.an.Array; res.should.have.property('identities').have.length(1); res.identities[0].should.have.property('pubkey').equal('12AbjvYY5hxV4v2KrN9pnGzgFxogwrzgYyncYHHsyFDK'); @@ -328,7 +328,7 @@ describe("Identities collision", function() { }); it('requirements by invalid pubkey', function() { - return expectError(404, "No identity matching this pubkey or uid", rp('http://127.0.0.1:7799/wot/requirements/cat?pubkey=true', { json: true })); + return expectError(404, "No identity matching this pubkey or uid", rp('http://127.0.0.1:7799/wot/requirements/cat?pubkey', { json: true })); }); it('should have certified-by/tic giving results', function() { -- GitLab