HttpClient.js 1.9 KB

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