simplify async requests
execute a get-request
Name | Type | Description | |
---|---|---|---|
url |
String
|
the url of the request |
rq.get("YOUR_URL").then(handleData).catch(handleError);
Void
execute a post-request
Name | Type | Description | |
---|---|---|---|
url |
String
|
the url of the request |
|
data |
Object
|
the data to be sent in the body |
rq.post("YOUR_URL", yourData).then(handleResponse).catch(handleError);
Void
execute a put-request
Name | Type | Description | |
---|---|---|---|
url |
String
|
the url of the request |
|
data |
Object
|
the data to be sent in the body |
rq.put("YOUR_URL", yourData).then(handleResponse).catch(handleError);
Void
execute a delete-request
Name | Type | Description | |
---|---|---|---|
url |
String
|
the url of the request |
rq.delete("YOUR_URL").then(handleResponse).catch(handleError);
Void
execute a fetch
Name | Type | Description | |
---|---|---|---|
url |
String
|
the url of the request |
|
options |
Object
|
the options object |
// define options
var options = {
method: "POST",
headers: new Headers({
"Content-Type": "application/json"
}),
body: JSON.stringify(data)
}
rq.fetch("YOUR_URL", options).then(handleResponse).catch(handleError);
Void
handle the response
Name | Type | Description | |
---|---|---|---|
response |
type
|
the full response object |
type
the parsed response
handle the json response
Name | Type | Description | |
---|---|---|---|
response |
type
|
the full json response object |
type
the parsed json response
handle the xml response
Name | Type | Description | |
---|---|---|---|
response |
type
|
the full xml response object |
type
the parsed xml response