Skip to content
This repository was archived by the owner on Oct 9, 2025. It is now read-only.

Commit 274c03b

Browse files
committed
Status code 400 is now thrown when .update() is invoked without any filters.
1 parent f30127e commit 274c03b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Request.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,12 +153,14 @@ class Request extends SuperAgent {
153153
end() {
154154
return new Promise((resolve, reject) => {
155155
// catch when .delete() is invoked without any filters
156-
if (this.method == 'DELETE' && this._query.length == 0) {
156+
if (['DELETE', 'PATCH'].includes(this.method) && this._query.length == 0) {
157+
let methodString = this.method === 'DELETE' ? '.delete()' : '.update()'
158+
157159
return resolve({
158160
body: null,
159161
status: 400,
160162
statusCode: 400,
161-
statusText: '.delete() cannot be invoked without any filters.',
163+
statusText: `${methodString} cannot be invoked without any filters.`,
162164
})
163165
}
164166

0 commit comments

Comments
 (0)