Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
body.forEach(function getID (invite) {
var username = invite.inviter.login
var inviteID = invite.id
// Accept each invite
options.url = 'https://api.github.com/user/repository_invitations/' + inviteID
request.patch(options, function accepted (err, response, body) {
if (err) return thunk(err)
console.log(new Date(), 'Accepted invite from', username, inviteID, response.statusCode)
acceptedCount++
// Once you've accepted 30, the batch max, try again
// to see if there are more, else you're done!
if (acceptedCount === 30) return acceptBatch()
if (acceptedCount === inviteCount) return thunk()
})
})
})
it('user1 should be able to PATCH a resource', function (done) {
var options = createOptions('/append-inherited/test.ttl', 'user1')
options.body = 'INSERT DATA { :test :hello 456 .}'
options.headers['content-type'] = 'application/sparql-update'
request.patch(options, function (error, response, body) {
assert.equal(error, null)
assert.equal(response.statusCode, 200)
done()
})
})
it('user1 should be able to access test file', function (done) {
it('should allow adding a vaccination', function(done) {
PETS[3].vaccinations = VACCINATIONS;
Request.patch({
url: BASE_URL + '/pets/3',
headers: USER_1,
body: {vaccinations: VACCINATIONS},
json: true,
}, successResponse(done))
})
function(next) {
var options = {
json: {
rsParams: {
priority: 99,
},
}
};
request.patch('http://127.0.0.1:13089/v1/replica_sets/test-cluster/members/' + initialPrimaryReplicaId, options, function(error, response) {
should.not.exist(error);
response.statusCode.should.eql(200);
next();
});
},
function(next) {
module.exports = function () {
let data = {
administratorEmail: config.get('administratorEmail'),
name: config.get('instanceName'),
description: config.get('frontPageText')
}
let worUrl = config.get('webOfRegistriesUrl')
let updateSecret = config.get('webOfRegistriesSecret')
let id = config.get('webOfRegistriesId')
if (!(worUrl && updateSecret && id)) { return }
data.updateSecret = updateSecret
request.patch(worUrl + '/instances/' + id + '/', {
json: data
}, (err, resp, body) => {
if (err) {
console.log('Web-of-Registries Update Error')
console.log(err)
} else {
if (body['updateSecret']) {
config.set('webOfRegistriesSecret', body['updateSecret'])
} else {
console.log('Web-of-Registries Update error')
console.log(body)
}
}
})
}
function updateTitoEventRelease (data, callback) {
const progressIndicator = ora('Updating ti.to Event release').start();
const { eventTime, eventReleaseApiId, eventReleaseApiUrl } = data;
request.patch({
url: `${eventReleaseApiUrl}`,
headers: TITO_HEADERS,
json: true,
body: {
data: {
type: 'releases',
id: eventReleaseApiId,
attributes: {
description: `Join us from ${eventTime} for an exciting day of learning and community! Start your journey with JavaScript, refine your grasp of the basics, or pick up something completely new!`
}
}
}
}, function (error, response, body) {
if (error) {
progressIndicator.stopAndPersist(FAILURE_SYMBOL);
callback(error);
.then((reqOptionsWithToken) => {
request.patch(reqOptionsWithToken, (err: Error, res: Response, resBody: any) => {
if (err) {
return reject(
new FirebaseError(`Unexpected error while removing data at ${path}`, {
exit: 2,
original: err,
})
);
}
const dt = Date.now() - t0;
if (res.statusCode >= 400) {
logger.debug(`[database] Failed to remove ${note} at ${path} time: ${dt}`);
return resolve(false);
}
logger.debug(`[database] Sucessfully removed ${note} at ${path} time: ${dt}`);
return resolve(true);
});
function updateStreamTitle(title) {
logger.info("updating channel title to: " + title);
let dbAuth = dataAccess.getJsonDbInUserData("/user-settings/auth");
let streamer = dbAuth.getData('/streamer');
request.patch('https://mixer.com/api/v1/channels/' + streamer['channelId'], {
'auth': {
'bearer': streamer['accessToken']
},
'body': {
name: title
},
json: true
}, (err) => {
if (err) {
logger.error("error setting title for channel", err);
}
});
}
.then(res => {
let gameList = res.body;
logger.silly(gameList);
if (gameList != null && Array.isArray(gameList) && gameList.length > 0) {
let firstGame = gameList[0];
request.patch('https://mixer.com/api/v1/channels/' + streamer['channelId'], {
'auth': {
'bearer': streamer['accessToken']
},
'body': {
typeId: firstGame.id
},
json: true
}, (err) => {
if (err) {
logger.error("error setting game for channel", err);
}
});
}
}, function (err) {
logger.error("error while looking up games", err);
getToken(sub, (err, token) => {
if (err) {
return reject(err);
}
const req = {
url: `https://${nconf.get('AUTH0_DOMAIN')}/api/v2/users/${encodeURIComponent(userId)}`,
body: body,
json: true,
headers: {
'Authorization': `Bearer ${token}`
}
};
request.patch(req, (error, res, body) => {
if (error || res.statusCode !== 200) {
return reject(body);
}
resolve(body);
});
});
});