47 lines
1.3 KiB
JavaScript
47 lines
1.3 KiB
JavaScript
// Licensed to the .NET Foundation under one or more agreements.
|
|
// The .NET Foundation licenses this file to you under the MIT license.
|
|
/** Represents an HTTP response. */
|
|
export class HttpResponse {
|
|
constructor(statusCode, statusText, content) {
|
|
this.statusCode = statusCode;
|
|
this.statusText = statusText;
|
|
this.content = content;
|
|
}
|
|
}
|
|
/** 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.
|
|
*/
|
|
export 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 "";
|
|
}
|
|
}
|
|
//# sourceMappingURL=HttpClient.js.map
|