rack-cors 1.0.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rack-cors might be problematic. Click here for more details.

@@ -1,26 +1,38 @@
1
- // Generated by CoffeeScript 1.12.6
1
+ // Generated by CoffeeScript 2.3.1
2
2
  (function() {
3
3
  var CORS_SERVER;
4
4
 
5
- CORS_SERVER = '127.0.0.1.xip.io:9292';
5
+ CORS_SERVER = '127.0.0.1.xip.io:3000';
6
+
7
+ mocha.setup({
8
+ ignoreLeaks: true
9
+ });
6
10
 
7
11
  describe('CORS', function() {
8
12
  it('should allow access to dynamic resource', function(done) {
9
- return $.get("http://" + CORS_SERVER + "/", function(data, status, xhr) {
13
+ return $.get(`http://${CORS_SERVER}/`, function(data, status, xhr) {
10
14
  expect(data).to.eql('Hello world');
11
15
  return done();
12
16
  });
13
17
  });
14
18
  it('should allow PUT access to dynamic resource', function(done) {
15
- return $.ajax("http://" + CORS_SERVER + "/", {
19
+ return $.ajax(`http://${CORS_SERVER}/`, {
16
20
  type: 'PUT'
17
21
  }).done(function(data, textStatus, jqXHR) {
18
22
  expect(data).to.eql('Hello world');
19
23
  return done();
20
24
  });
21
25
  });
26
+ it('should allow PATCH access to dynamic resource', function(done) {
27
+ return $.ajax(`http://${CORS_SERVER}/`, {
28
+ type: 'PATCH'
29
+ }).done(function(data, textStatus, jqXHR) {
30
+ expect(data).to.eql('Hello world');
31
+ return done();
32
+ });
33
+ });
22
34
  it('should allow HEAD access to dynamic resource', function(done) {
23
- return $.ajax("http://" + CORS_SERVER + "/", {
35
+ return $.ajax(`http://${CORS_SERVER}/`, {
24
36
  type: 'HEAD'
25
37
  }).done(function(data, textStatus, jqXHR) {
26
38
  expect(jqXHR.status).to.eql(200);
@@ -28,7 +40,7 @@
28
40
  });
29
41
  });
30
42
  it('should allow DELETE access to dynamic resource', function(done) {
31
- return $.ajax("http://" + CORS_SERVER + "/", {
43
+ return $.ajax(`http://${CORS_SERVER}/`, {
32
44
  type: 'DELETE'
33
45
  }).done(function(data, textStatus, jqXHR) {
34
46
  expect(data).to.eql('Hello world');
@@ -36,7 +48,7 @@
36
48
  });
37
49
  });
38
50
  it('should allow OPTIONS access to dynamic resource', function(done) {
39
- return $.ajax("http://" + CORS_SERVER + "/", {
51
+ return $.ajax(`http://${CORS_SERVER}/`, {
40
52
  type: 'OPTIONS'
41
53
  }).done(function(data, textStatus, jqXHR) {
42
54
  expect(jqXHR.status).to.eql(200);
@@ -44,15 +56,15 @@
44
56
  });
45
57
  });
46
58
  it('should allow access to static resource', function(done) {
47
- return $.get("http://" + CORS_SERVER + "/static.txt", function(data, status, xhr) {
48
- expect($.trim(data)).to.eql("hello world");
59
+ return $.get(`http://${CORS_SERVER}/static.txt`, function(data, status, xhr) {
60
+ expect($.trim(data)).to.eql("Hello world");
49
61
  return done();
50
62
  });
51
63
  });
52
64
  return it('should allow post resource', function(done) {
53
65
  return $.ajax({
54
66
  type: 'POST',
55
- url: "http://" + CORS_SERVER + "/cors",
67
+ url: `http://${CORS_SERVER}/cors`,
56
68
  beforeSend: function(xhr) {
57
69
  return xhr.setRequestHeader('X-Requested-With', 'XMLHTTPRequest');
58
70
  },