Skip to content

Commit ae2095d

Browse files
committed
Extend RESTBuilder by adding .robot() and .mobile() methods.
1 parent 52688c3 commit ae2095d

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

builders.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3674,6 +3674,22 @@ RESTBuilder.prototype.origin = function(value) {
36743674
return this;
36753675
};
36763676

3677+
RESTBuilder.prototype.robot = function() {
3678+
if (this.$headers['User-Agent'])
3679+
this.$headers['User-Agent'] += ' Bot';
3680+
else
3681+
this.$headers['User-Agent'] = 'Bot';
3682+
return this;
3683+
};
3684+
3685+
RESTBuilder.prototype.mobile = function() {
3686+
if (this.$headers['User-Agent'])
3687+
this.$headers['User-Agent'] += ' iPhone';
3688+
else
3689+
this.$headers['User-Agent'] = 'iPhone';
3690+
return this;
3691+
};
3692+
36773693
RESTBuilder.prototype.put = function(data) {
36783694
if (this.$method !== 'put') {
36793695
this.$flags = null;

0 commit comments

Comments
 (0)