You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Set the data serializer which will be used for all future PATCH, POST and PUT requests. Takes a string representing the name of the serializer.
105
105
106
106
```js
@@ -183,6 +183,42 @@ Remove all cookies associated with a given URL.
183
183
cordova.plugin.http.removeCookies(url, callback);
184
184
```
185
185
186
+
### sendRequest
187
+
Execute a HTTP request. Takes a URL and an options object. This is the internally used implementation of the following shorthand functions ([post](#post), [get](#get), [put](#put), [patch](#patch), [delete](#delete), [head](#head), [uploadFile](#uploadFile) and [downloadFile](#downloadFile)). You can use this function, if you want to override global settings for each single request.
188
+
189
+
The options object contains following keys:
190
+
191
+
*`method`: HTTP method to be used, defaults to `get`, needs to be one of the following values:
*`data`: payload to be send to the server (only applicable on `post`, `put` or `patch` methods)
194
+
*`params`: query params to be appended to the URL (only applicable on `get`, `head`, `delete`, `upload` or `download` methods)
195
+
*`serializer`: data serializer to be used (only applicable on `post`, `put` or `patch` methods), defaults to global serializer value, see [setDataSerializer](#setDataSerializer) for supported values
196
+
*`timeout`: timeout value for the request in seconds, defaults to global timeout value
197
+
*`headers`: headers object (key value pair), will be merged with global values
198
+
*`filePath`: filePath to be used during upload and download see [uploadFile](#uploadFile) and [downloadFile](#downloadFile) for detailed information
199
+
*`name`: name to be used during upload see [uploadFile](#uploadFile) for detailed information
Execute a POST request. Takes a URL, data, and headers.
188
224
@@ -241,7 +277,7 @@ Here's a quick example:
241
277
}
242
278
```
243
279
244
-
### get
280
+
### get<aname="get"></a>
245
281
Execute a GET request. Takes a URL, parameters, and headers. See the [post](#post) documentation for details on what is returned on success and failure.
Execute a PUT request. Takes a URL, data, and headers. See the [post](#post) documentation for details on what is returned on success and failure.
260
296
261
-
### patch
297
+
### patch<aname="patch"></a>
262
298
Execute a PATCH request. Takes a URL, data, and headers. See the [post](#post) documentation for details on what is returned on success and failure.
263
299
264
-
### delete
300
+
### delete<aname="delete"></a>
265
301
Execute a DELETE request. Takes a URL, parameters, and headers. See the [post](#post) documentation for details on what is returned on success and failure.
266
302
267
-
### head
303
+
### head<aname="head"></a>
268
304
Execute a HEAD request. Takes a URL, parameters, and headers. See the [post](#post) documentation for details on what is returned on success and failure.
269
305
270
-
### uploadFile
306
+
### uploadFile<aname="uploadFile"></a>
271
307
Uploads a file saved on the device. Takes a URL, parameters, headers, filePath, and the name of the parameter to pass the file along as. See the [post](#post) documentation for details on what is returned on success and failure.
Downloads a file and saves it to the device. Takes a URL, parameters, headers, and a filePath. See [post](#post) documentation for details on what is returned on failure. On success this function returns a cordova [FileEntry object](http://cordova.apache.org/docs/en/3.3.0/cordova_file_file.md.html#FileEntry).
0 commit comments