request.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. request.get = function(url, options){
  43. // summary:
  44. // Send an HTTP GET request using the default transport for the current platform.
  45. // url: String
  46. // URL to request
  47. // options: dojo/request.__BaseOptions?
  48. // Options for the request.
  49. // returns: dojo/request.__Promise
  50. };
  51. request.post = function(url, options){
  52. // summary:
  53. // Send an HTTP POST request using the default transport for the current platform.
  54. // url: String
  55. // URL to request
  56. // options: dojo/request.__BaseOptions?
  57. // Options for the request.
  58. // returns: dojo/request.__Promise
  59. };
  60. request.put = function(url, options){
  61. // summary:
  62. // Send an HTTP POST request using the default transport for the current platform.
  63. // url: String
  64. // URL to request
  65. // options: dojo/request.__BaseOptions?
  66. // Options for the request.
  67. // returns: dojo/request.__Promise
  68. };
  69. request.del = function(url, options){
  70. // summary:
  71. // Send an HTTP DELETE request using the default transport for the current platform.
  72. // url: String
  73. // URL to request
  74. // options: dojo/request.__BaseOptions?
  75. // Options for the request.
  76. // returns: dojo/request.__Promise
  77. };
  78. =====*/
  79. return request;
  80. });