Skip to content

Commit 89f3fe8

Browse files
committed
Fix empty headers
1 parent acdd2e1 commit 89f3fe8

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

src/collection.js

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -168,10 +168,12 @@ class BaseCollection {
168168
const {promise, callback} = this._connection.promisify(cb)
169169
const headers = {}
170170
const {rev, ...qsOpts} = opts || {}
171-
if (this._connection.arangoMajor < 3) {
172-
qsOpts.rev = rev
173-
} else {
174-
headers.rev = rev
171+
if (rev) {
172+
if (this._connection.arangoMajor < 3) {
173+
qsOpts.rev = rev
174+
} else {
175+
headers.rev = rev
176+
}
175177
}
176178
this._api.put(
177179
this._documentPath(documentHandle),
@@ -194,10 +196,12 @@ class BaseCollection {
194196
const {promise, callback} = this._connection.promisify(cb)
195197
const headers = {}
196198
const {rev, ...qsOpts} = opts || {}
197-
if (this._connection.arangoMajor < 3) {
198-
qsOpts.rev = rev
199-
} else {
200-
headers.rev = rev
199+
if (rev) {
200+
if (this._connection.arangoMajor < 3) {
201+
qsOpts.rev = rev
202+
} else {
203+
headers.rev = rev
204+
}
201205
}
202206
this._api.patch(
203207
this._documentPath(documentHandle),
@@ -220,10 +224,12 @@ class BaseCollection {
220224
const {promise, callback} = this._connection.promisify(cb)
221225
const headers = {}
222226
const {rev, ...qsOpts} = opts || {}
223-
if (this._connection.arangoMajor < 3) {
224-
qsOpts.rev = rev
225-
} else {
226-
headers.rev = rev
227+
if (rev) {
228+
if (this._connection.arangoMajor < 3) {
229+
qsOpts.rev = rev
230+
} else {
231+
headers.rev = rev
232+
}
227233
}
228234
this._api.delete(
229235
this._documentPath(documentHandle),

0 commit comments

Comments
 (0)