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

Commit ad3aa17

Browse files
committed
Fix for #49
1 parent 59111f6 commit ad3aa17

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

src/Builder.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ class Builder {
144144
return this
145145
}
146146

147-
range(from, to) {
147+
range(from, to = null) {
148148
this.queryFilters.push({
149149
filter: 'range',
150150
from,

src/Request.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,9 +211,18 @@ class Request extends SuperAgent {
211211
* @returns {Request} The API request object.
212212
*/
213213

214-
range(from, to) {
215-
let lowerBound = from || 0
216-
let upperBound = to == 0 ? 0 : to || ''
214+
range(from, to = null) {
215+
if (typeof from != 'number' || (typeof to != 'number' && to != null)) {
216+
return {
217+
body: null,
218+
status: 400,
219+
statusCode: 400,
220+
statusText: `.range() cannot be invoked with parameters that are not numbers.`,
221+
}
222+
}
223+
224+
let lowerBound = from
225+
let upperBound = to == null ? '' : to
217226

218227
this.set('Range-Unit', 'items')
219228
this.set('Range', `${lowerBound}-${upperBound}`)

0 commit comments

Comments
 (0)