<commit_before>import OsfAdapter from './osf-adapter';
import Ember from 'ember';

export default OsfAdapter.extend({
    namespace : '',

    ajax: function(url, method, hash) {
        hash.crossDomain = true;
        hash.xhrFields = {withCredentials: true};
        return this._super(url, method, hash);
    },

    headers: Ember.computed(function() {
        var csrftoken = "";
        try {
            csrftoken = Ember.get(document.cookie.match(/csrftoken\=([^;]*)/), "1");
        } catch(e){
            console.log(e);
            console.log('no csrftoken present');
        }

        return { "X-CSRFToken": csrftoken };
    }).volatile()
});<commit_msg>Changing the adapter so that it actually works<commit_after>import DS from 'ember-data';
import Ember from 'ember';

import config from 'ember-get-config';

export default DS.JSONAPIAdapter.extend({
    namespace : '',
    host: config.OSF.apiUrl,

    buildURL(){
        var url = this._super(...arguments)
        if (url.lastIndexOf('/') !== url.length - 1) {
            url += '/';
        }
        return url;
    },
    ajax: function(url, method, hash) {
        hash = hash || {};
        hash.crossDomain = true;
        hash.xhrFields = {withCredentials: true};
        return this._super(url, method, hash);
    },

    headers: Ember.computed(function() {
        var csrftoken = "";
        try {
            csrftoken = Ember.get(document.cookie.match(/csrftoken\=([^;]*)/), "1");
        } catch(e){
            console.log(e);
            console.log('no csrftoken present');
        }

        return { "X-CSRFToken": csrftoken };
    }).volatile()
});
{'fraction_non_alphanumeric': 0.15824710894704808, 'fraction_numerical': 0.0018259281801582471, 'mean_word_length': 2.2046783625730995, 'pattern_counts': {'":': 2, '<': 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': '4197864', 'n_tokens_mistral': 519, 'n_tokens_neox': 507, 'n_words': 110}