49 lines
1.8 KiB
JavaScript
49 lines
1.8 KiB
JavaScript
// Copyright (c) .NET Foundation. All rights reserved.
|
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
|
var __assign = (this && this.__assign) || Object.assign || function(t) {
|
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
s = arguments[i];
|
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
t[p] = s[p];
|
|
}
|
|
return t;
|
|
};
|
|
/** Represents an HTTP response. */
|
|
var HttpResponse = /** @class */ (function () {
|
|
function HttpResponse(statusCode, statusText, content) {
|
|
this.statusCode = statusCode;
|
|
this.statusText = statusText;
|
|
this.content = content;
|
|
}
|
|
return HttpResponse;
|
|
}());
|
|
export { HttpResponse };
|
|
/** Abstraction over an HTTP client.
|
|
*
|
|
* This class provides an abstraction over an HTTP client so that a different implementation can be provided on different platforms.
|
|
*/
|
|
var HttpClient = /** @class */ (function () {
|
|
function HttpClient() {
|
|
}
|
|
HttpClient.prototype.get = function (url, options) {
|
|
return this.send(__assign({}, options, { method: "GET", url: url }));
|
|
};
|
|
HttpClient.prototype.post = function (url, options) {
|
|
return this.send(__assign({}, options, { method: "POST", url: url }));
|
|
};
|
|
HttpClient.prototype.delete = function (url, options) {
|
|
return this.send(__assign({}, options, { method: "DELETE", url: url }));
|
|
};
|
|
/** Gets all cookies that apply to the specified URL.
|
|
*
|
|
* @param url The URL that the cookies are valid for.
|
|
* @returns {string} A string containing all the key-value cookie pairs for the specified URL.
|
|
*/
|
|
// @ts-ignore
|
|
HttpClient.prototype.getCookieString = function (url) {
|
|
return "";
|
|
};
|
|
return HttpClient;
|
|
}());
|
|
export { HttpClient };
|
|
//# sourceMappingURL=HttpClient.js.map
|