Skip to content

Commit 7ca2681

Browse files
authored
fix: Incorrectly attempting to send body in GET, DELETE requests (#169)
1 parent 0999242 commit 7ca2681

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

.github/workflows/ci.yml

+2
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ jobs:
4444
with:
4545
fail_ci_if_error: true
4646
token: ${{ secrets.CODECOV_TOKEN }}
47+
env:
48+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
4749
concurrency:
4850
group: ${{ github.workflow }}-${{ github.ref }}
4951
cancel-in-progress: true

lib/client.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ module.exports = function (dependencies) {
567567
responseData += data;
568568
});
569569

570-
if (Object.keys(notification.body).length > 0) {
570+
if (notification.body !== '{}') {
571571
request.write(notification.body);
572572
}
573573

test/client.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1761,7 +1761,7 @@ describe('ManageChannelsClient', () => {
17611761
const mockHeaders = { 'apns-channel-id': channel, ...additionalHeaderInfo };
17621762
const mockNotification = {
17631763
headers: mockHeaders,
1764-
body: {},
1764+
body: '{}',
17651765
};
17661766
const bundleId = BUNDLE_ID;
17671767
const result = await client.write(mockNotification, bundleId, 'channels', 'delete');
@@ -1822,7 +1822,7 @@ describe('ManageChannelsClient', () => {
18221822
const mockHeaders = { 'apns-request-id': requestId };
18231823
const mockNotification = {
18241824
headers: mockHeaders,
1825-
body: {},
1825+
body: '{}',
18261826
};
18271827
const bundleId = BUNDLE_ID;
18281828
const result = await client.write(mockNotification, bundleId, 'allChannels', 'get');

test/notification/index.js

+5
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ describe('Notification', function () {
1717
expect(note.topic).to.equal('io.apn.node');
1818
expect(compiledOutput()).to.have.nested.deep.property('aps.badge', 5);
1919
});
20+
21+
it('no initialization values', function () {
22+
expect(note.compile()).to.equal('{}');
23+
expect(compiledOutput()).to.be.empty;
24+
});
2025
});
2126

2227
describe('rawPayload', function () {

0 commit comments

Comments
 (0)