Skip to content

Commit

Permalink
dev: Send body as search parameters for delete requests
Browse files Browse the repository at this point in the history
  • Loading branch information
kschiffer committed Jun 26, 2023
1 parent 1da8d60 commit bddc8a7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
12 changes: 8 additions & 4 deletions cypress/integration/console/devices/unclaim.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand Down
2 changes: 1 addition & 1 deletion sdk/js/src/api/http.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit bddc8a7

Please sign in to comment.