<commit_before>angular.module('main.module')
  .service('core-rest.service', ['$log', '$http', '$location', function($log, $http, $location) {

      // Return the promise object to the users.
      var _getPromiseObject = function(method, url, contentType, data, isArray) {

        isArray = typeof isArray !== 'undefined' ? isArray : false;

        var promiseObject = $http({
          method: method,
          url: url,
          headers: {'Content-Type': contentType},
          isArray: isArray,
          data: data
        });

        return promiseObject;
      };


      /* window.location.hostname for the webserver  */

      var _defaultHost = 'http://' + $location.host() + ':9090/api';
      var _defaultContentType = 'application/json';


      // Services interacting with the karamel core.
      return{
        jsonToYaml: function(json) {
          var method = 'PUT';
          var url = _defaultHost.concat("/definition/json2yaml");
          return _getPromiseObject(method, url, _defaultContentType, json);
        },
        yamlToJson: function(ymlString) {
          var method = 'PUT';
          var url = _defaultHost.concat("/definition/yaml2json");
          return _getPromiseObject(method, url, _defaultContentType, ymlString);
        },
        getCookBookInfo: function(requestData) {

          var method = 'PUT';
          var url = _defaultHost.concat("/definition/fetchCookbook");
          return _getPromiseObject(method, url, _defaultContentType, requestData);
        },
        loadSshKeys: function() {<commit_msg>Remove hardcoded 9090 port for the UI (#203)<commit_after>angular.module('main.module')
  .service('core-rest.service', ['$log', '$http', '$location', function($log, $http, $location) {

      // Return the promise object to the users.
      var _getPromiseObject = function(method, url, contentType, data, isArray) {

        isArray = typeof isArray !== 'undefined' ? isArray : false;

        var promiseObject = $http({
          method: method,
          url: url,
          headers: {'Content-Type': contentType},
          isArray: isArray,
          data: data
        });

        return promiseObject;
      };


      /* window.location.hostname for the webserver  */
      var _defaultHost = 'http://' + $location.host() + ':' + $location.port() + '/api';
      var _defaultContentType = 'application/json';


      // Services interacting with the karamel core.
      return{
        jsonToYaml: function(json) {
          var method = 'PUT';
          var url = _defaultHost.concat("/definition/json2yaml");
          return _getPromiseObject(method, url, _defaultContentType, json);
        },
        yamlToJson: function(ymlString) {
          var method = 'PUT';
          var url = _defaultHost.concat("/definition/yaml2json");
          return _getPromiseObject(method, url, _defaultContentType, ymlString);
        },
        getCookBookInfo: function(requestData) {

          var method = 'PUT';
          var url = _defaultHost.concat("/definition/fetchCookbook");
          return _getPromiseObject(method, url, _defaultContentType, requestData);
        },
        loadSshKeys: function() {
{'fraction_non_alphanumeric': 0.12476429918290384, 'fraction_numerical': 0.004714016341923318, 'mean_word_length': 2.4673202614379086, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5628697', 'n_tokens_mistral': 889, 'n_tokens_neox': 848, 'n_words': 216}