cloudflare
Version:
The official TypeScript library for the Cloudflare API
30 lines • 1.39 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from 'cloudflare/resource';
import * as AlwaysUseHTTPSAPI from 'cloudflare/resources/zones/settings/always-use-https';
export class AlwaysUseHTTPS extends APIResource {
/**
* Reply to all requests for URLs that use "http" with a 301 redirect to the
* equivalent "https" URL. If you only want to redirect for a subset of requests,
* consider creating an "Always use HTTPS" page rule.
*/
edit(params, options) {
const { zone_id, ...body } = params;
return this._client.patch(`/zones/${zone_id}/settings/always_use_https`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Reply to all requests for URLs that use "http" with a 301 redirect to the
* equivalent "https" URL. If you only want to redirect for a subset of requests,
* consider creating an "Always use HTTPS" page rule.
*/
get(params, options) {
const { zone_id } = params;
return this._client.get(`/zones/${zone_id}/settings/always_use_https`, options)._thenUnwrap((obj) => obj.result);
}
}
(function (AlwaysUseHTTPS) {
AlwaysUseHTTPS.AlwaysUseHTTPS = AlwaysUseHTTPSAPI.AlwaysUseHTTPS;
})(AlwaysUseHTTPS || (AlwaysUseHTTPS = {}));
//# sourceMappingURL=always-use-https.mjs.map