mirror of
https://github.com/silkimen/cordova-plugin-advanced-http.git
synced 2024-10-06 09:12:13 +08:00
implement e2e specs for #155
This commit is contained in:
parent
aded59e3d1
commit
588e4a0e57
@ -869,6 +869,27 @@ const tests = [
|
||||
parsed.data.should.be.equal('data:application/octet-stream;base64,' + b64Logo);
|
||||
}
|
||||
},
|
||||
{
|
||||
description: 'should perform an OPTIONS request correctly #155',
|
||||
expected: 'resolved: {"status":200,"headers":{"allow":"GET, PUT, DELETE, HEAD, PATCH, TRACE, POST, OPTIONS" ...',
|
||||
func: function (resolve, reject) { cordova.plugin.http.options('http://httpbin.org/anything', {}, {}, resolve, reject); },
|
||||
validationFunc: function (driver, result) {
|
||||
result.type.should.be.equal('resolved');
|
||||
result.data.status.should.be.equal(200);
|
||||
|
||||
result.data.headers.should.be.an('object');
|
||||
result.data.headers.allow.should.include('GET');
|
||||
result.data.headers.allow.should.include('PUT');
|
||||
result.data.headers.allow.should.include('DELETE');
|
||||
result.data.headers.allow.should.include('HEAD');
|
||||
result.data.headers.allow.should.include('PATCH');
|
||||
result.data.headers.allow.should.include('TRACE');
|
||||
result.data.headers.allow.should.include('POST');
|
||||
result.data.headers.allow.should.include('OPTIONS');
|
||||
|
||||
result.data.headers['access-control-allow-origin'].should.be.equal('*');
|
||||
}
|
||||
},
|
||||
|
||||
// TODO: not ready yet
|
||||
// {
|
||||
|
Loading…
Reference in New Issue
Block a user