52 lines
1.5 KiB
JavaScript
52 lines
1.5 KiB
JavaScript
"use strict";
|
|
// Licensed to the .NET Foundation under one or more agreements.
|
|
// The .NET Foundation licenses this file to you under the MIT license.
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.HttpClient = exports.HttpResponse = void 0;
|
|
/** Represents an HTTP response. */
|
|
class HttpResponse {
|
|
constructor(statusCode, statusText, content) {
|
|
this.statusCode = statusCode;
|
|
this.statusText = statusText;
|
|
this.content = content;
|
|
}
|
|
}
|
|
exports.HttpResponse = 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.
|
|
*/
|
|
class HttpClient {
|
|
get(url, options) {
|
|
return this.send({
|
|
...options,
|
|
method: "GET",
|
|
url,
|
|
});
|
|
}
|
|
post(url, options) {
|
|
return this.send({
|
|
...options,
|
|
method: "POST",
|
|
url,
|
|
});
|
|
}
|
|
delete(url, options) {
|
|
return this.send({
|
|
...options,
|
|
method: "DELETE",
|
|
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
|
|
getCookieString(url) {
|
|
return "";
|
|
}
|
|
}
|
|
exports.HttpClient = HttpClient;
|
|
//# sourceMappingURL=HttpClient.js.map
|