Request object in two ways:new Request(input: string | Request, initOptions?: RequestInit): Request
Parameter Name | Type | Required | Description |
input | string | Request | Yes | URL string or Request object. |
initOptions | No | Configuration items for initializing the Request object. |
Property Name | Type | Required | Default Value | Description |
method | string | No | GET | Request method ( GET, POST, and so on). |
headers | No | - | Request header information. | |
body | No | - | Request body. | |
redirect | string | No | follow | Redirect policy. Supported values: manual, error, and follow. |
maxFollow | number | No | 12 | Maximum number of redirects. |
version | string | No | HTTP/1.1 | HTTP version. Supported values: HTTP/1.0, HTTP/1.1, and HTTP/2.0. |
copyHeaders | boolean | No | - | Non-standard Web APIs option. Indicates whether to copy the headers of the incoming Request object. |
eo | No | - | Non-standard Web APIs option. Controls the behavior of edge functions when they process this request. |
Parameter Name | Type | Required | Description |
resolveOverride | string | No | Overrides the original domain resolution for fetch requests and supports specifying a domain name or IP address. For more information, see below: The IP address is not allowed to contain a scheme or port number. IPv6 addresses do not need to be enclosed in square brackets. Note: This field does not take effect when fetch meets the condition of accessing the EdgeOne node cache or origin-pull. |
image | No | Image processing parameter configuration item. | |
cacheKey | string | No | Custom cache key used for cache read and write operations of the Cache API: after it is specified, relevant cache operations use an independent edge function cache that is isolated from the EdgeOne site cache. For details on how to specify it and the rules for it to take effect, see Cache Space. |
timeoutSetting | No | ||
tls | No | Note: This field takes effect only when fetch does not meet the condition of accessing the EdgeOne node cache or origin-pull. |
fetch timeout option.fetch times out while establishing a connection, a net_exception_connect_timeout exception is thrown. If fetch times out while reading a response or sending a request, a net_exception_timeout exception is thrown.Parameter Name | Type | Required | Default Value | Description |
connectTimeout | number | No | 3000 | Timeout for establishing a connection, in milliseconds, with a maximum of 300000. |
readTimeout | number | No | 3000 | Timeout for reading a response, in milliseconds, with a maximum of 300000. |
writeTimeout | number | No | 15000 | Timeout for sending a request, in milliseconds, with a maximum of 300000. |
fetch TLS-related options take effect only when fetch does not meet the conditions for accessing the EdgeOne node cache or origin-pull.Parameter Name | Type | Required | Description |
cert | string | No | Client certificate in PEM format. |
key | string | No | Private key paired with the client certificate, in PEM format. |
ca | string | No | CA certificate corresponding to the origin server certificate, in PEM format. |
// request.bodyreadonly body: ReadableStream;
// request.bodyUsedreadonly bodyUsed: boolean;
// request.headersreadonly headers: Headers;
// request.methodreadonly method: string;
GET.// request.redirectreadonly redirect: string;
follow, error, manual. The default value is follow.follow may cause issues in some scenarios. For more information, see Redirect.// request.maxFollowreadonly maxFollow: number;
// request.urlreadonly url: string;
// request.versionreadonly version: string;
// request.eoreadonly eo: IncomingRequestEoProperties;
Property Name | Type | Description | Example Value |
geo | Describes the location information of the client request. | - | |
tls | Describes the TLS information of the client request. This field has a value only when the client request is a TLS request. | - | |
clientIp | string | Client request IP address. | 192.168.1.1 |
clientPort | number | Client request port. | - |
httpProtocol | string | HTTP protocol version of the client request. | HTTP/1.1 |
uuid | string | Unique identifier of the request, functioning the same as EO-LOG-UUID. | - |
Property Name | Type | Description | Example Value |
asn | number | ASN. | 132203 |
continent | string | Continent name. | Asia |
countryName | string | Country name. | Singapore |
countryCodeAlpha2 | string | ISO-3166 alpha2 code of the country. | SG |
countryCodeAlpha3 | string | ISO-3166 alpha3 code of the country. | SGP |
countryCodeNumeric | string | ISO-3166 numeric code of the country. | 702 |
regionName | string | Region name. | - |
regionCode | string | Region code. | AA-AA |
cityName | string | City name. | Singapore |
latitude | number | Latitude. | 1.29027 |
longitude | number | Longitude. | 103.851959 |
Property Name | Type | Description | Example Value |
version | string | TLS version requested by the client. | TLS1.3 |
cipher | string | TLS cipher suite requested by the client. | TLS_AES_256_GCM_SHA384 |
clientAuth | Describes the information related to the client certificate. This field has a value only when the client carries a certificate request. | - | |
clientCiphersSha1 | string | SHA-1 hash value (Base64-encoded) of the cipher_suites list sent by the client in ClientHello during the TLS handshake, encoded in big-endian format. | - |
clientExtensionsSha1 | string | SHA-1 hash value (Base64-encoded) of the extensions list sent by the client in ClientHello during the TLS handshake, encoded in big-endian format. | - |
clientExtensionsSha1Le | string | SHA-1 hash value (Base64-encoded) of the extensions list sent by the client in ClientHello during the TLS handshake, encoded in little-endian format. | - |
clientHelloLength | string | Byte length of the ClientHello message sent by the client during the TLS handshake. | - |
clientRandom | string | 32-byte random field (Base64-encoded) sent by the client in ClientHello during the TLS handshake. | - |
Property Name | Type | Description | Example Value |
certPresented | string | Whether the client actually sent the certificate. The value is always "1". | 1 |
certVerified | string | Verification result of the client certificate. There are only two values: "SUCCESS" (successful verification) and "FAILED" (failed verification). | SUCCESS |
certIssuerDN | string | - | |
certSubjectDN | string | - | |
certIssuerDNRFC2253 | string | - | |
certSubjectDNRFC2253 | string | - | |
certIssuerDNLegacy | string | Unique Distinguished Name (DN) of the client certificate issuer, in OpenSSL legacy format. | - |
certSubjectDNLegacy | string | Unique Distinguished Name (DN) of the client certificate subject, in OpenSSL legacy format. | - |
certSerial | string | Serial number of the client certificate. | - |
certIssuerSerial | string | Serial number of the CA certificate that issued this client certificate (the serialNumber field in the issuer certificate). | - |
certSKI | string | Subject Key Identifier (SKI) of the client certificate. | - |
certIssuerSKI | string | Subject Key Identifier (SKI) of the client certificate issuer. | - |
certFingerprintSHA1 | string | SHA-1 fingerprint of the client certificate. | - |
certFingerprintSHA256 | string | SHA-256 fingerprint of the client certificate. | - |
certNotBefore | string | Jan 01 00:00:00 2026 GMT | |
certNotAfter | string | Jan 01 00:00:00 2026 GMT | |
certPublicKeyAlgorithm | string | Public key algorithm type of the client certificate, with values "RSA", "DSA", "EC", "ED25519", "SM2", and "Other". | - |
certPublicKeyAlgorithmLongName | string | Long name of the public key algorithm of the client certificate, passed through from OpenSSL. | - |
certPublicKeyAlgorithmShortName | string | Short name of the public key algorithm of the client certificate, passed through from OpenSSL. | - |
OverSize exception is thrown. In this case, it is recommended to use request.body for streaming reads. For more information, see ReadableStream.request.arrayBuffer(): Promise<ArrayBuffer>;
request.blob(): Promise<Blob>;
request.clone(copyHeaders?: boolean): Request;
Parameter Name | Type | Required | Description |
copyHeaders | boolean | No | Enables copying request headers. The default value is false. The values are described as follows.true Copies the request headers of the source object. false References the request headers of the source object. |
request.formData(): Promise<FormData>;
request.json(): Promise<object>;
JSON.request.text(): Promise<string>;
async function handleRequest() {const request = new Request('https://www.tencentcloud.com/');const response = await fetch(request);return response;}addEventListener('fetch', (event) => {event.respondWith(handleRequest());});
Apakah halaman ini membantu?
Anda juga dapat Menghubungi Penjualan atau Mengirimkan Tiket untuk meminta bantuan.
masukan