From c14781252ef90cb89046a44b94960ef17bcba9d3 Mon Sep 17 00:00:00 2001 From: Kevin Schiffer Date: Sun, 18 Jun 2023 12:13:48 +0200 Subject: [PATCH 1/2] dev: Send body as search parameters for delete requests --- CHANGELOG.md | 1 + .../integration/console/devices/unclaim.spec.js | 14 +++++++++----- sdk/js/src/api/http.js | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 202c0cf652..46e02cd1ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ For details about compatibility between different releases, see the **Commitment ### Fixed - Console not applying webhook field masks when creating a webhook from a template that has field masks set. +- Removing user invitations not working in the user management panel for administrators. ### Security diff --git a/cypress/integration/console/devices/unclaim.spec.js b/cypress/integration/console/devices/unclaim.spec.js index 49791b715b..bbd4a9403f 100644 --- a/cypress/integration/console/devices/unclaim.spec.js +++ b/cypress/integration/console/devices/unclaim.spec.js @@ -73,7 +73,7 @@ describe('Device un-claiming', () => { }) it('succeeds un-claiming and deleting an end device', () => { - cy.intercept('DELETE', `/api/v3/edcs/claim/${appId}/devices/${endDeviceId}`, {}).as( + cy.intercept('DELETE', `/api/v3/edcs/claim/${appId}/devices/${endDeviceId}?*`, {}).as( 'unclaim-request', ) @@ -86,10 +86,14 @@ describe('Device un-claiming', () => { cy.findByRole('button', { name: /Unclaim and delete end device/ }).click() }) - cy.wait('@unclaim-request').its('request.body').should('deep.equal', { - dev_eui: ns.end_device.ids.dev_eui, - join_eui: '0000000000000000', - }) + cy.wait('@unclaim-request') + .its('request.url') + .then(url => { + const params = new URLSearchParams(new URL(url).search) + + expect(params.get('dev_eui')).to.equal(ns.end_device.ids.dev_eui) + expect(params.get('join_eui')).to.equal('0000000000000000') + }) cy.findByTestId('error-notification').should('not.exist') diff --git a/sdk/js/src/api/http.js b/sdk/js/src/api/http.js index cc29c17fdc..d4df5501bf 100644 --- a/sdk/js/src/api/http.js +++ b/sdk/js/src/api/http.js @@ -108,7 +108,7 @@ class Http { url: endpoint, } - if (method === 'get') { + if (method === 'get' || method === 'delete') { // For GETs convert payload to query params (should usually // be field_mask only). config.params = this._payloadToQueryParams(payload) From 32384014f94a8b0f9baf82d93c32b6038665c542 Mon Sep 17 00:00:00 2001 From: Kevin Schiffer Date: Mon, 26 Jun 2023 18:18:54 +0200 Subject: [PATCH 2/2] Update CHANGELOG.md --- CHANGELOG.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 30246ee4b6..cf7b21997a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,7 +21,6 @@ For details about compatibility between different releases, see the **Commitment ### Fixed -- Console not applying webhook field masks when creating a webhook from a template that has field masks set. - Removing user invitations not working in the user management panel for administrators. - Fix payload formatter page launching malformed requests in the Console. - HTTP API routes for parsing QR codes for the QR Generator service. We exercise our right to break compatibility with third party HTTP clients since this is a bug.