Skip to content

Commit ada0d1a

Browse files
author
Josh Mervine
committed
Fixing a bug with calling delete on a single file as a string.
1 parent 90f93ad commit ada0d1a

File tree

4 files changed

+20
-6
lines changed

4 files changed

+20
-6
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
### v0.1.4
44

55
- Adding alias for `maxcdn.del`.
6+
- Fixing a bug with calling delete on a single file as string.
67

78
### v0.1.3
89

README.md

-5
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,6 @@ maxcdn.del('zones/pull.json/'+zoneId+'/cache', files, function(err, results) {
9494
});
9595
```
9696

97-
#### Not Implemented
98-
99-
* post - fails with error, getting the same error with Ruby gem.
100-
101-
10297
## Running Tests
10398

10499
#### Unit Tests

index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ function del(url, files, callback) {
9696
}
9797

9898
if (typeof files === 'string') {
99-
files = "files="+string;
99+
files = "files="+files;
100100
} else if (Array.isArray(files)) {
101101
files = stringify(files);
102102
} else if (files && files.files) {

test/index_test.js

+18
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,15 @@ test('maxcdn', function(t) {
9595
t.notOk(data.arguments[3], 'delete sends data');
9696
});
9797

98+
m.delete('path', 'path1', function(err, data) {
99+
t.error(err, 'delete (via Array) w/o error');
100+
t.equal(data.foo, 'bar', 'delete (via Array) w/ data');
101+
t.equal(data.arguments[0],
102+
'https://rws.netdna.com/alias/path?files=path1',
103+
'delete (via Array) w/ path');
104+
t.notOk(data.arguments[3], 'delete (via Array) sends data');
105+
});
106+
98107
m.delete('path', ['path1','path2'], function(err, data) {
99108
t.error(err, 'delete (via Array) w/o error');
100109
t.equal(data.foo, 'bar', 'delete (via Array) w/ data');
@@ -120,6 +129,15 @@ test('maxcdn', function(t) {
120129
t.notOk(data.arguments[3], 'del sends data');
121130
});
122131

132+
m.del('path', 'path1', function(err, data) {
133+
t.error(err, 'delete (via Array) w/o error');
134+
t.equal(data.foo, 'bar', 'delete (via Array) w/ data');
135+
t.equal(data.arguments[0],
136+
'https://rws.netdna.com/alias/path?files=path1',
137+
'delete (via Array) w/ path');
138+
t.notOk(data.arguments[3], 'delete (via Array) sends data');
139+
});
140+
123141
m.del('path', ['path1','path2'], function(err, data) {
124142
t.error(err, 'del (via Array) w/o error');
125143
t.equal(data.foo, 'bar', 'del (via Array) w/ data');

0 commit comments

Comments
 (0)