diff --git a/src/keri/app/aiding.ts b/src/keri/app/aiding.ts index c0bad4d1..f508f182 100644 --- a/src/keri/app/aiding.ts +++ b/src/keri/app/aiding.ts @@ -112,7 +112,7 @@ export class Identifier { * @returns {Promise} A promise to the identifier information */ async get(name: string): Promise { - const path = `/identifiers/${name}`; + const path = `/identifiers/${encodeURIComponent(name)}`; const data = null; const method = 'GET'; const res = await this.client.fetch(path, method, data); diff --git a/src/keri/app/clienting.ts b/src/keri/app/clienting.ts index 20b8e8d2..de2e5986 100644 --- a/src/keri/app/clienting.ts +++ b/src/keri/app/clienting.ts @@ -182,9 +182,7 @@ export class SignifyClient { headers.set('Content-Type', 'application/json'); const _body = method == 'GET' ? null : JSON.stringify(data); - if (_body !== null) { - headers.set('Content-Length', String(_body.length)); - } + if (this.authn) { signed_headers = this.authn.sign( headers, diff --git a/test/app/aiding.test.ts b/test/app/aiding.test.ts index 898ce65d..b2e333f9 100644 --- a/test/app/aiding.test.ts +++ b/test/app/aiding.test.ts @@ -99,6 +99,15 @@ describe('Aiding', () => { assert.deepEqual(lastCall.body.salty.transferable, true); }); + it('Can get identifiers with special characters in the name', async () => { + client.fetch.mockResolvedValue(Response.json({})); + await client.identifiers().get('a name with ñ!'); + + const lastCall = client.getLastMockRequest(); + assert.equal(lastCall.method, 'GET'); + assert.equal(lastCall.path, '/identifiers/a%20name%20with%20%C3%B1!'); + }); + it('Can create salty AID with multiple signatures', async () => { client.fetch.mockResolvedValue(Response.json({}));