Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send DELETE payload as search parameters for delete requests in JS SDK #6333

Merged
merged 3 commits into from
Jun 27, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ 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.
kschiffer marked this conversation as resolved.
Show resolved Hide resolved
- 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.
- `/qr-code/end-devices/parse` is changed to `/qr-codes/end-devices/parse`.
Expand Down
14 changes: 9 additions & 5 deletions cypress/integration/console/devices/unclaim.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
)

Expand All @@ -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