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