<commit_before>import Ember from 'ember';
import layout from '../templates/components/x-xml-http-request';

import XRequest from 'x-request/x-request';

export default Ember.Component.extend({
  layout: layout,

  'data': '',
  'method': 'POST',
  'response-type': 'json',
  'with-credentials': false,
  'timeout': 0,
  'url': '',

  generateRequest: Ember.observer('method', 'response-type', 'with-credentials', 'url', 'data', function() {
    console.log('generateReqquest');
    this.request = new XRequest({
      freeze: false,
      responseType: this.get('response-type'),
      withCredentials: this.get('with-credentials'),
      timeout: this.get('timeout'),
      observe: Ember.run.bind(this, function(state) {
        this.set('model', state);
      })
    });
    this.request.open(this.get('method'), this.get('url'));
    this.request.send(this.get('data'));
    this.set('model', this.request.state);
  }),

  didInitAttrs() {
    this.generateRequest();
  }
});<commit_msg>make compatible with ember 1.10<commit_after>import Ember from 'ember';
import layout from '../templates/components/x-xml-http-request';

import XRequest from 'x-request/x-request';

export default Ember.Component.extend({
  layout: layout,

  'data': '',
  'method': 'POST',
  'response-type': 'json',
  'with-credentials': false,
  'timeout': 0,
  'url': '',

  generateRequest: Ember.observer('method', 'response-type', 'with-credentials', 'url', 'data', function() {
    this.request = new XRequest({
      freeze: false,
      responseType: this.get('response-type'),
      withCredentials: this.get('with-credentials'),
      timeout: this.get('timeout'),
      observe: Ember.run.bind(this, function(state) {
        this.set('model', state);
      })
    });
    this.request.open(this.get('method'), this.get('url'));
    this.request.send(this.get('data'));
    this.set('model', this.request.state);
  }),

  didInsertElement() {
    this.generateRequest();
  }
});
{'fraction_non_alphanumeric': 0.19064565327910524, 'fraction_numerical': 0.002541942043721403, 'mean_word_length': 3.7766990291262137, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '3816501', 'n_tokens_mistral': 631, 'n_tokens_neox': 628, 'n_words': 119}