Merge branch 'setTimeout' of https://github.com/YouYue123/cordova-plugin-advanced-http into YouYue123-setTimeout

# Conflicts:
#	README.md
#	src/android/com/silkimen/cordovahttp/CordovaHttpBase.java
#	src/android/com/silkimen/cordovahttp/CordovaHttpDownload.java
#	src/android/com/silkimen/cordovahttp/CordovaHttpOperation.java
#	src/ios/CordovaHttpPlugin.m
#	www/public-interface.js
This commit is contained in:
Sefa Ilkimen
2021-08-20 04:37:49 +02:00
10 changed files with 113 additions and 46 deletions
+22
View File
@@ -148,12 +148,32 @@ describe('Advanced HTTP public interface', function () {
it('configures global timeout value correctly with given valid value', () => {
http.setRequestTimeout(10);
http.getRequestTimeout().should.equal(10);
http.getConnectTimeout().should.equal(10);
http.getReadTimeout().should.equal(10);
});
it('throws an Error when you try to configure global timeout with a string', () => {
(() => { http.setRequestTimeout('myString'); }).should.throw(messages.INVALID_TIMEOUT_VALUE);
});
it('configures connect timeout value correctly with given valid value', () => {
http.setConnectTimeout(10);
http.getConnectTimeout().should.equal(10);
})
it('throws an Error when you try to configure connect timeout with a string', () => {
(() => { http.setConnectTimeout('myString'); }).should.throw(messages.INVALID_TIMEOUT_VALUE);
})
it('configures read timeout value correctly with given valid value', () => {
http.setReadTimeout(10);
http.getReadTimeout().should.equal(10);
})
it('throws an Error when you try to configure connect timeout with a string', () => {
(() => { http.setReadTimeout('myString'); }).should.throw(messages.INVALID_TIMEOUT_VALUE);
})
it('sets global option for following redirects correctly', () => {
http.setFollowRedirect(false);
http.getFollowRedirect().should.equal(false);
@@ -381,6 +401,8 @@ describe('Common helpers', function () {
serializer: 'urlencoded',
followRedirect: true,
timeout: 60.0,
connectTimeout: 30.0,
readTimeout: 30.0
}
it('adds missing "followRedirect" option correctly', () => {