HttpClient.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // Copyright (c) .NET Foundation. All rights reserved.
  2. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
  3. var __assign = (this && this.__assign) || Object.assign || function(t) {
  4. for (var s, i = 1, n = arguments.length; i < n; i++) {
  5. s = arguments[i];
  6. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
  7. t[p] = s[p];
  8. }
  9. return t;
  10. };
  11. /** Represents an HTTP response. */
  12. var HttpResponse = /** @class */ (function () {
  13. function HttpResponse(statusCode, statusText, content) {
  14. this.statusCode = statusCode;
  15. this.statusText = statusText;
  16. this.content = content;
  17. }
  18. return HttpResponse;
  19. }());
  20. export { HttpResponse };
  21. /** Abstraction over an HTTP client.
  22. *
  23. * This class provides an abstraction over an HTTP client so that a different implementation can be provided on different platforms.
  24. */
  25. var HttpClient = /** @class */ (function () {
  26. function HttpClient() {
  27. }
  28. HttpClient.prototype.get = function (url, options) {
  29. return this.send(__assign({}, options, { method: "GET", url: url }));
  30. };
  31. HttpClient.prototype.post = function (url, options) {
  32. return this.send(__assign({}, options, { method: "POST", url: url }));
  33. };
  34. HttpClient.prototype.delete = function (url, options) {
  35. return this.send(__assign({}, options, { method: "DELETE", url: url }));
  36. };
  37. /** Gets all cookies that apply to the specified URL.
  38. *
  39. * @param url The URL that the cookies are valid for.
  40. * @returns {string} A string containing all the key-value cookie pairs for the specified URL.
  41. */
  42. // @ts-ignore
  43. HttpClient.prototype.getCookieString = function (url) {
  44. return "";
  45. };
  46. return HttpClient;
  47. }());
  48. export { HttpClient };
  49. //# sourceMappingURL=HttpClient.js.map