Skip to content

Commit fd4c8ba

Browse files
committed
Don't read body on 204 status (pre4)
1 parent 2e16d1c commit fd4c8ba

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

index.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,13 @@ class DisStat extends EventEmitter {
106106
this.emit("post", false)
107107
return e
108108
})
109-
const json = await response.json()
110109

111-
this.emit("post", response.ok, json)
112-
if (!response.ok) return json
110+
if (response.status == 204) this.emit("post", true)
111+
else {
112+
const json = await response.json()
113+
this.emit("post", response.ok, json)
114+
return json
115+
}
113116
}
114117

115118
async postCommand(command = "", userId = void 0, guildId = void 0) {

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "disstat",
3-
"version": "1.0.0-pre3",
3+
"version": "1.0.0-pre4",
44
"description": "Post data from a discord.js client automatically, or manually to DisStat for Discord bot statistic tracking.",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)