forked from dojo/dojo-oldmirror
-
Notifications
You must be signed in to change notification settings - Fork 0
/
request.js
81 lines (80 loc) · 2.55 KB
/
request.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
define([
'./request/default!'/*=====,
'./_base/declare',
'./promise/Promise' =====*/
], function(request/*=====, declare, Promise =====*/){
/*=====
request = function(url, options){
// summary:
// Send a request using the default transport for the current platform.
// url: String
// The URL to request.
// options: dojo/request.__Options?
// Options for the request.
// returns: dojo/request.__Promise
};
request.__Promise = declare(Promise, {
// response: dojo/promise/Promise
// A promise resolving to an object representing
// the response from the server.
});
request.__BaseOptions = declare(null, {
// query: String|Object?
// Query parameters to append to the URL.
// data: String|Object?
// Data to transfer. This is ignored for GET and DELETE
// requests.
// preventCache: Boolean?
// Whether to append a cache-busting parameter to the URL.
// timeout: Integer?
// Milliseconds to wait for the response. If this time
// passes, the then the promise is rejected.
// handleAs: String?
// How to handle the response from the server. Default is
// 'text'. Other values are 'json', 'javascript', and 'xml'.
});
request.__MethodOptions = declare(null, {
// method: String?
// The HTTP method to use to make the request. Must be
// uppercase.
});
request.__Options = declare([request.__BaseOptions, request.__MethodOptions]);
request.get = function(url, options){
// summary:
// Send an HTTP GET request using the default transport for the current platform.
// url: String
// URL to request
// options: dojo/request.__BaseOptions?
// Options for the request.
// returns: dojo/request.__Promise
};
request.post = function(url, options){
// summary:
// Send an HTTP POST request using the default transport for the current platform.
// url: String
// URL to request
// options: dojo/request.__BaseOptions?
// Options for the request.
// returns: dojo/request.__Promise
};
request.put = function(url, options){
// summary:
// Send an HTTP POST request using the default transport for the current platform.
// url: String
// URL to request
// options: dojo/request.__BaseOptions?
// Options for the request.
// returns: dojo/request.__Promise
};
request.del = function(url, options){
// summary:
// Send an HTTP DELETE request using the default transport for the current platform.
// url: String
// URL to request
// options: dojo/request.__BaseOptions?
// Options for the request.
// returns: dojo/request.__Promise
};
=====*/
return request;
});