Skip to content

Commit 4497e00

Browse files
author
Sefa Ilkimen
committed
feat(http): add support for new methods (#2249)
1 parent 0e68bd9 commit 4497e00

File tree

1 file changed

+55
-10
lines changed

1 file changed

+55
-10
lines changed

src/@ionic-native/plugins/http/index.ts

Lines changed: 55 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export interface HTTPResponse {
3333
* ```typescript
3434
* import { HTTP } from '@ionic-native/http';
3535
*
36-
* constructor(private http: HTTP) { }
36+
* constructor(private http: HTTP) {}
3737
*
3838
* ...
3939
*
@@ -89,43 +89,80 @@ export class HTTP extends IonicNativePlugin {
8989
useBasicAuth(username: string, password: string): void {}
9090

9191
/**
92-
* Set a header for all future requests. Takes a header and a value.
92+
* Get all headers defined for a given hostname.
93+
* @param host {string} The hostname
94+
* @returns {string} return all headers defined for the hostname
95+
*/
96+
@Cordova({ sync: true })
97+
getHeaders(host: string): string {
98+
return;
99+
}
100+
101+
/**
102+
* Set a header for all future requests. Takes a hostname, a header and a value.
103+
* @param host {string} The hostname to be used for scoping this header
93104
* @param header {string} The name of the header
94105
* @param value {string} The value of the header
95106
*/
96107
@Cordova({ sync: true })
97-
setHeader(header: string, value: string): void {}
108+
setHeader(host: string, header: string, value: string): void {}
109+
110+
/**
111+
* Get the name of the data serializer which will be used for all future POST and PUT requests.
112+
* @returns {string} returns the name of the configured data serializer
113+
*/
114+
@Cordova({ sync: true })
115+
getDataSerializer(): string {
116+
return;
117+
}
98118

99119
/**
100120
* Set the data serializer which will be used for all future POST and PUT requests. Takes a string representing the name of the serializer.
101-
* @param serializer {string} The name of the serializer. Can be urlencoded or json
121+
* @param serializer {string} The name of the serializer. Can be urlencoded, utf8 or json
102122
*/
103123
@Cordova({ sync: true })
104124
setDataSerializer(serializer: string): void {}
105125

106126
/**
107-
* Clear all cookies
127+
* Add a custom cookie.
128+
* @param url {string} Scope of the cookie
129+
* @param cookie {string} RFC compliant cookie string
130+
*/
131+
@Cordova({ sync: true })
132+
setCookie(url: string, cookie: string): void {}
133+
134+
/**
135+
* Clear all cookies.
108136
*/
109137
@Cordova({ sync: true })
110138
clearCookies(): void {}
111139

112140
/**
113-
* Remove cookies
141+
* Remove cookies for given URL.
114142
* @param url {string}
115143
* @param cb
116144
*/
117145
@Cordova({ sync: true })
118146
removeCookies(url: string, cb: () => void): void {}
119147

120148
/**
121-
* Disable following redirects automatically
122-
* @param disable {boolean} Set to true to disable following redirects automatically
149+
* Resolve cookie string for given URL.
150+
* @param url {string}
123151
*/
124152
@Cordova({ sync: true })
125-
disableRedirect(disable: boolean): void {}
153+
getCookieString(url: string): string { return; }
126154

127155
/**
128-
* Set request timeout
156+
* Get global request timeout value in seconds.
157+
* @returns {number} returns the global request timeout value
158+
*/
159+
@Cordova({ sync: true })
160+
getRequestTimeout(): number {
161+
return;
162+
}
163+
164+
/**
165+
* Set global request timeout value in seconds.
129166
* @param timeout {number} The timeout in seconds. Default 60
130167
*/
131168
@Cordova({ sync: true })
@@ -155,6 +192,14 @@ export class HTTP extends IonicNativePlugin {
155192
return;
156193
}
157194

195+
/**
196+
* Disable following redirects automatically.
197+
* @param disable {boolean} Set to true to disable following redirects automatically
198+
* @returns {Promise<void>} returns a promise that will resolve on success, and reject on failure
199+
*/
200+
@Cordova()
201+
disableRedirect(disable: boolean): Promise<void> { return; }
202+
158203
/**
159204
* Make a POST request
160205
* @param url {string} The url to send the request to

0 commit comments

Comments
 (0)