feat(http): use a different plugin source with better features (#1921)

This commit is contained in:
Raman Rasliuk 2017-08-26 09:57:23 +02:00 committed by Ibby Hadeed
parent 332f9aefe5
commit a2d33963b1
2 changed files with 73 additions and 15 deletions

24
package-lock.json generated
View File

@ -43,15 +43,15 @@
"dev": true "dev": true
}, },
"@types/jasmine": { "@types/jasmine": {
"version": "2.5.48", "version": "2.5.54",
"resolved": "https://registry.npmjs.org/@types/jasmine/-/jasmine-2.5.48.tgz", "resolved": "https://registry.npmjs.org/@types/jasmine/-/jasmine-2.5.54.tgz",
"integrity": "sha512-XelrQlM8WM8JqZSnjDC51ojku80PT/fMgqCxVFK1kg8ABg6WxDxZwr4R9ITfRC6CFwXElSbINj0ZUHf/7YzQkw==", "integrity": "sha512-B9YofFbUljs19g5gBKUYeLIulsh31U5AK70F41BImQRHEZQGm4GcN922UvnYwkduMqbC/NH+9fruWa/zrqvHIg==",
"dev": true "dev": true
}, },
"@types/node": { "@types/node": {
"version": "7.0.23", "version": "7.0.42",
"resolved": "https://registry.npmjs.org/@types/node/-/node-7.0.23.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-7.0.42.tgz",
"integrity": "sha512-F+qaJi0iw9Yk7Ugml+HtTi2r399gPEFfKh2lwr86/a/5LVHODiAllBlNCNrgo5sT9WRHl74ryEbXVeNUN3ToCQ==", "integrity": "sha512-cF/2SHIITu6Xen1DqBobqsx63Bdui37ZnID90G/vkuF1T7orBijcgyYcgkRpChCRwoRaf4LV/jXjrfVtFL/Y8Q==",
"dev": true "dev": true
}, },
"abbrev": { "abbrev": {
@ -5760,9 +5760,9 @@
} }
}, },
"rxjs": { "rxjs": {
"version": "5.1.1", "version": "5.4.0",
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-5.1.1.tgz", "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-5.4.0.tgz",
"integrity": "sha1-/EiSKWW8bF77zA/kbpCjr2QTens=", "integrity": "sha1-p9sUqxV/nXqsalbmVeejhg05vyY=",
"dev": true, "dev": true,
"requires": { "requires": {
"symbol-observable": "1.0.4" "symbol-observable": "1.0.4"
@ -6992,9 +6992,9 @@
"dev": true "dev": true
}, },
"zone.js": { "zone.js": {
"version": "0.8.11", "version": "0.8.12",
"resolved": "https://registry.npmjs.org/zone.js/-/zone.js-0.8.11.tgz", "resolved": "https://registry.npmjs.org/zone.js/-/zone.js-0.8.12.tgz",
"integrity": "sha1-dCvvsX+8SaVxcSuMfYfljKJv2IY=", "integrity": "sha1-hv9QU8mK7CkaC/S7rFAdaUoFz7s=",
"dev": true "dev": true
} }
} }

View File

@ -59,9 +59,9 @@ export interface HTTPResponse {
*/ */
@Plugin({ @Plugin({
pluginName: 'HTTP', pluginName: 'HTTP',
plugin: 'cordova-plugin-http', plugin: 'cordova-plugin-advanced-http',
pluginRef: 'cordovaHTTP', pluginRef: 'cordovaHTTP',
repo: 'https://github.com/wymsee/cordova-HTTP', repo: 'https://github.com/silkimen/cordova-plugin-advanced-http',
platforms: ['Android', 'iOS'] platforms: ['Android', 'iOS']
}) })
@Injectable() @Injectable()
@ -92,6 +92,34 @@ export class HTTP extends IonicNativePlugin {
@Cordova({ sync: true }) @Cordova({ sync: true })
setHeader(header: string, value: string): void { } setHeader(header: string, value: string): void { }
/**
* Set the data serializer which will be used for all future POST and PUT requests. Takes a string representing the name of the serializer.
* @param serializer {string} The name of the serializer. Can be urlencoded or json
*/
@Cordova({ sync: true })
setDataSerializer(serializer: string): void { }
/**
* Clear all cookies
*/
@Cordova({ sync: true })
clearCookies(): void { }
/**
* Remove cookies
* @param url {string}
* @param cb
*/
@Cordova({ sync: true })
removeCookies(url: string, cb: () => void): void { }
/**
* Set request timeout
* @param timeout {number} The timeout in seconds. Default 60
*/
@Cordova({ sync: true })
setRequestTimeout(timeout: number): void { }
/** /**
* Enable or disable SSL Pinning. This defaults to false. * Enable or disable SSL Pinning. This defaults to false.
* *
@ -131,7 +159,7 @@ export class HTTP extends IonicNativePlugin {
post(url: string, body: any, headers: any): Promise<HTTPResponse> { return; } post(url: string, body: any, headers: any): Promise<HTTPResponse> { return; }
/** /**
* * Make a GET request
* @param url {string} The url to send the request to * @param url {string} The url to send the request to
* @param parameters {Object} Parameters to send with the request * @param parameters {Object} Parameters to send with the request
* @param headers {Object} The headers to set for this request * @param headers {Object} The headers to set for this request
@ -140,6 +168,36 @@ export class HTTP extends IonicNativePlugin {
@Cordova() @Cordova()
get(url: string, parameters: any, headers: any): Promise<HTTPResponse> { return; } get(url: string, parameters: any, headers: any): Promise<HTTPResponse> { return; }
/**
* Make a PUT request
* @param url {string} The url to send the request to
* @param body {Object} The body of the request
* @param headers {Object} The headers to set for this request
* @returns {Promise<HTTPResponse>} returns a promise that resolve on success, and reject on failure
*/
@Cordova()
put(url: string, body: any, headers: any): Promise<HTTPResponse> { return; }
/**
* Make a DELETE request
* @param url {string} The url to send the request to
* @param parameters {Object} Parameters to send with the request
* @param headers {Object} The headers to set for this request
* @returns {Promise<HTTPResponse>} returns a promise that resolve on success, and reject on failure
*/
@Cordova()
delete(url: string, parameters: any, headers: any): Promise<HTTPResponse> { return; }
/**
* Make a HEAD request
* @param url {string} The url to send the request to
* @param parameters {Object} Parameters to send with the request
* @param headers {Object} The headers to set for this request
* @returns {Promise<HTTPResponse>} returns a promise that resolve on success, and reject on failure
*/
@Cordova()
head(url: string, parameters: any, headers: any): Promise<HTTPResponse> { return; }
/** /**
* *
* @param url {string} The url to send the request to * @param url {string} The url to send the request to