<commit_before>var corpseFaceApp = angular.module('corpseFaceApp', []);

corpseFaceApp.controller('requestCtrl', ['$scope', '$http', function ($scope, $http)
{
    // this configures the headers for all HTTP requests

    corpseFaceApp.config(function($httpProvider)
    {
      $httpProvider.defaults.useXDomain = true;
      delete $httpProvider.defaults.headers.common['X-Requested-With'];
    });

    // this is a test method for GET requests to the server - it is successful (i.e. without CORS errors)

    $scope.testGet = function ()
    {
      var config =
      {
        method: 'GET',
        url: 'https://corpsebook-server.herokuapp.com/stories/',
        headers: {
          'Content-Type': 'application/json',
          'Accept': 'application/json'
        }
      }

      $http(config)
      .success(function (data){
        console.log(data);
      });
    }

    // this is a method for posting user signIn objects - it is currently not fleshed out

    $scope.user = {};

    $scope.signIn = function (user)
    {
        console.log("signIn");
    }

    // this is a method for posting story objects to the server - it is currently getting CORS errors

    $scope.story = {};

     $scope.createNewStory = function (story)
      {
        story = {story : story}
        console.log(story);

        var config =
        {
            method: 'POST',
            url: 'https://corpsebook-server.herokuapp.com/stories/',
            headers: {
              'Content-Type': 'application/json',
              'Accept': 'application/json'
            },
            data: story<commit_msg>renamed current controller to 'requestCtrl' to specify its responsibility for HTTP requests<commit_after>var corpseFaceApp = angular.module('corpseFaceApp', []);

corpseFaceApp.controller('requestCtrl', ['$scope', '$http', function ($scope, $http)
{
    // this configures the headers for all HTTP requests

    corpseFaceApp.config(function($httpProvider)
    {
      $httpProvider.defaults.useXDomain = true;
      delete $httpProvider.defaults.headers.common['X-Requested-With'];
    });

    // this is a test method for GET requests to the server - it is successful (i.e. without CORS errors)

    $scope.testGet = function ()
    {
      var config =
      {
        method: 'GET',
        url: 'https://corpsebook-server.herokuapp.com/stories/',
        headers: {
          'Content-Type': 'application/json',
          'Accept': 'application/json'
        }
      }

      $http(config)
      .success(function (data){
        console.log(data);
      });
    }

    // this is a method for posting user signIn objects - it is currently not fleshed out

    $scope.user = {};

    $scope.signIn = function (user)
    {
        console.log("signIn");
    }

    // this is a method for posting story objects to the server - it is currently getting CORS errors

    $scope.story = {};

     $scope.createNewStory = function (story)
      {
        story = {story : story}
        console.log(story);

        var config =
        {
            method: 'POST',
            url: 'https://corpsebook-server.herokuapp.com/stories',
            headers: {
              'Content-Type': 'application/json',
              'Accept': 'application/json'
            },
            data: story
{'fraction_non_alphanumeric': 0.125719478945774, 'fraction_numerical': 0.0, 'mean_word_length': 2.1239356669820246, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, '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': '6688048', 'n_tokens_mistral': 947, 'n_tokens_neox': 920, 'n_words': 240}