Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //INCORRECT VIM
- var ServiceRequest = {
- // Change the status of given service to given status
- changeServiceStatus: function changeServiceStatus (service, status, option) {
- request.post(option(service.componentid, status) , function(error) {
- if (error) {
- return console.error('Got an error:',error);
- }
- console.log(service.name + ' has changed status to ' + status);
- });
- },
- // GET request to grab latest results from given test and update status with the
- // statusio request
- update: function update (option, service) {
- request.get(option(service.endpoint), function(error, response, body) {
- if (error) {
- return console.error('Got an error:',error);
- }
- var parsed = JSON.parse(body);
- //Updates status based on Runscope result
- if (parsed.data.result !== 'fail') {
- changeServiceStatus(service, 100, options.status_update);
- }
- else {
- changeServiceStatus(service, 500, options.status_update);
- }
- });
- };
- }
- //CORRECT WEBSTORM
- var ServiceRequest = {
- // Change the status of given service to given status
- changeServiceStatus: function changeServiceStatus(service, status, option) {
- request.post(option(service.componentid, status), function(error) {
- if (error) {
- return console.error('Got an error:', error);
- }
- console.log(service.name + ' has changed status to ' + status);
- });
- },
- // GET request to grab latest results from given test and update status with the
- // statusio request
- update: function update(option, service) {
- request.get(option(service.endpoint), function(error, response, body) {
- if (error) {
- return console.error('Got an error:', error);
- }
- var parsed = JSON.parse(body);
- //Updates status based on Runscope result
- if (parsed.data.result !== 'fail') {
- changeServiceStatus(service, 100, options.status_update);
- }
- else {
- changeServiceStatus(service, 500, options.status_update);
- }
- });
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement