ember-auth-source 3.0.2 → 3.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/dist/ember-auth.js +28 -13
  2. metadata +3 -3
@@ -204,33 +204,48 @@
204
204
  }
205
205
  },
206
206
  ajax: function(settings) {
207
- var def, token;
207
+ var data, def, e, token, _base, _base1, _base2, _base3, _name, _name1, _name2, _name3;
208
208
 
209
209
  if (settings == null) {
210
210
  settings = {};
211
211
  }
212
212
  def = {};
213
+ def.dataType = 'json';
214
+ if (settings.data && (settings.contentType == null) && settings.type !== 'GET') {
215
+ def.contentType = 'application/json; charset=utf-8';
216
+ settings.data = JSON.stringify(settings.data);
217
+ }
218
+ settings = jQuery.extend(def, settings);
213
219
  if (token = this.get('authToken')) {
214
220
  switch (Auth.Config.get('requestTokenLocation')) {
215
221
  case 'param':
216
- def.data || (def.data = {});
217
- def.data[Auth.Config.get('tokenKey')] = this.get('authToken');
222
+ switch (typeof settings.data) {
223
+ case 'undefined':
224
+ settings.data = {};
225
+ (_base = settings.data)[_name = Auth.Config.get('tokenKey')] || (_base[_name] = this.get('authToken'));
226
+ break;
227
+ case 'object':
228
+ (_base1 = settings.data)[_name1 = Auth.Config.get('tokenKey')] || (_base1[_name1] = this.get('authToken'));
229
+ break;
230
+ case 'string':
231
+ try {
232
+ data = JSON.parse(settings.data);
233
+ data[_name2 = Auth.Config.get('tokenKey')] || (data[_name2] = this.get('authToken'));
234
+ settings.data = JSON.stringify(data);
235
+ } catch (_error) {
236
+ e = _error;
237
+ }
238
+ }
218
239
  break;
219
240
  case 'authHeader':
220
- def.headers || (def.headers = {});
221
- def.headers['Authorization'] = "" + (Auth.Config.get('requestHeaderKey')) + " " + (this.get('authToken'));
241
+ settings.headers || (settings.headers = {});
242
+ (_base2 = settings.headers)['Authorization'] || (_base2['Authorization'] = "" + (Auth.Config.get('requestHeaderKey')) + " " + (this.get('authToken')));
222
243
  break;
223
244
  case 'customHeader':
224
- def.headers || (def.headers = {});
225
- def.headers[Auth.Config.get('requestHeaderKey')] = this.get('authToken');
245
+ settings.headers || (settings.headers = {});
246
+ (_base3 = settings.headers)[_name3 = Auth.Config.get('requestHeaderKey')] || (_base3[_name3] = this.get('authToken'));
226
247
  }
227
248
  }
228
- def.dataType = 'json';
229
- if (settings.data && (settings.contentType == null) && settings.type !== 'GET') {
230
- def.contentType = 'application/json; charset=utf-8';
231
- settings.data = JSON.stringify(settings.data);
232
- }
233
- settings = jQuery.extend(def, settings);
234
249
  return jQuery.ajax(settings);
235
250
  }
236
251
  });
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ember-auth-source
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.2
4
+ version: 3.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-04-06 00:00:00.000000000 Z
12
+ date: 2013-04-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ember-rails
@@ -51,7 +51,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
51
51
  version: '0'
52
52
  segments:
53
53
  - 0
54
- hash: 675329521
54
+ hash: -829773711
55
55
  required_rubygems_version: !ruby/object:Gem::Requirement
56
56
  none: false
57
57
  requirements: