API Reference

API参考

Request

请求

  1. {
  2. // Constructor
  3. constructor(object: options)
  4. // Properties
  5. url (string)
  6. body (any)
  7. headers (Headers)
  8. method (string)
  9. params (object)
  10. timeout (number)
  11. credentials (boolean)
  12. emulateHTTP (boolean)
  13. emulateJSON (boolean)
  14. before (function(Request))
  15. progress (function(Event))
  16. // Methods
  17. getUrl() (string)
  18. getBody() (any)
  19. respondWith(any: body, object: options) (Response)
  20. }

Response

响应

  1. {
  2. // Constructor
  3. constructor(any: body, object: {string: url, object: headers, number: status, string: statusText})
  4. // Properties
  5. url (string)
  6. body (any)
  7. headers (Headers)
  8. ok (boolean)
  9. status (number)
  10. statusText (string)
  11. // Methods
  12. blob() (Promise)
  13. text() (Promise)
  14. json() (Promise)
  15. }

Headers

头部

  1. {
  2. // Constructor
  3. constructor(object: headers)
  4. // Properties
  5. map (object)
  6. // Methods
  7. has(string: name) (boolean)
  8. get(string: name) (string)
  9. getAll() (string[])
  10. set(string: name, string: value) (void)
  11. append(string: name, string: value) (void)
  12. delete(string: name) (void)
  13. forEach(function: callback, any: thisArg) (void)
  14. }