Skip to content

Commit 8cd6342

Browse files
authored
Merge pull request #936 from swagger-api/issue-642
added test
2 parents 6c9fc89 + 0167213 commit 8cd6342

File tree

1 file changed

+37
-1
lines changed

1 file changed

+37
-1
lines changed

test/client.js

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1650,10 +1650,46 @@ describe('SwaggerClient', function () {
16501650
}).then(function(client) {
16511651
var mock = client.test.slash({}, {mock: true});
16521652
expect(mock.url).toBe('http://localhost:8000/double/foo?happy=');
1653-
16541653
done();
16551654
}).catch(function(exception) {
16561655
done(exception);
16571656
});
16581657
});
1658+
1659+
it('passes data in a delete with formData', function(done) {
1660+
1661+
var spec = {
1662+
paths: {
1663+
'/foo': {
1664+
delete: {
1665+
tags: [
1666+
'test'
1667+
],
1668+
operationId: 'removeMe',
1669+
consumes: [
1670+
'x-www-form-urlencoded'
1671+
],
1672+
parameters: [{
1673+
in: 'formData',
1674+
name: 'username',
1675+
type: 'string',
1676+
required: false
1677+
}],
1678+
}
1679+
}
1680+
}
1681+
};
1682+
new SwaggerClient({
1683+
url: 'http://localhost:8000/v2/swagger.json',
1684+
spec: spec,
1685+
usePromise: true
1686+
}).then(function(client) {
1687+
var mock = client.test.removeMe({username: 'Tony'}, {mock: true});
1688+
expect(mock.body).toBe('username=Tony');
1689+
expect(mock.headers['Content-Type']).toBe('application/x-www-form-urlencoded');
1690+
done();
1691+
}).catch(function(exception) {
1692+
done(exception);
1693+
});
1694+
})
16591695
});

0 commit comments

Comments
 (0)