• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2021-2023 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16import type { AsyncCallback, Callback } from './@ohos.base';
17import type connection from './@ohos.net.connection';
18
19/**
20 * Provides http related APIs.
21 * @namespace http
22 * @syscap SystemCapability.Communication.NetStack
23 * @since 6
24 */
25/**
26 * Provides http related APIs.
27 * @namespace http
28 * @syscap SystemCapability.Communication.NetStack
29 * @crossplatform
30 * @since 10
31 */
32/**
33 * Provides http related APIs.
34 * @namespace http
35 * @syscap SystemCapability.Communication.NetStack
36 * @crossplatform
37 * @atomicservice
38 * @since 11
39 */
40declare namespace http {
41  /**
42   * @syscap SystemCapability.Communication.NetStack
43   * @since 10
44   */
45  /**
46   * @syscap SystemCapability.Communication.NetStack
47   * @atomicservice
48   * @since 11
49   */
50  type HttpProxy = connection.HttpProxy;
51
52  /**
53   * Creates an HTTP request task.
54   * @returns { HttpRequest } the HttpRequest of the createHttp.
55   * @syscap SystemCapability.Communication.NetStack
56   * @since 6
57   */
58  /**
59   * Creates an HTTP request task.
60   * @returns { HttpRequest } the HttpRequest of the createHttp.
61   * @syscap SystemCapability.Communication.NetStack
62   * @crossplatform
63   * @since 10
64   */
65  /**
66   * Creates an HTTP request task.
67   * @returns { HttpRequest } the HttpRequest of the createHttp.
68   * @syscap SystemCapability.Communication.NetStack
69   * @crossplatform
70   * @atomicservice
71   * @since 11
72   */
73  function createHttp(): HttpRequest;
74
75  /**
76   * Enum for Address Family
77   * @enum {string}
78   * @syscap SystemCapability.Communication.NetStack
79   * @since 15
80   */
81  export enum AddressFamily {
82    /**
83     * Default, can use addresses of all IP versions that your system allows.
84     * @syscap SystemCapability.Communication.NetStack
85     * @crossplatform
86     * @since 15
87     */
88    DEFAULT = 'CURL_IPRESOLVE_WHATEVER',
89
90    /**
91     * ONLYV4 Uses only IPv4 addresses.
92     * @syscap SystemCapability.Communication.NetStack
93     * @crossplatform
94     * @since 15
95     */
96    ONLY_V4 = 'CURL_IPRESOLVE_V4',
97
98    /**
99     * ONLYV6 Uses only IPv6 addresses.
100     * @syscap SystemCapability.Communication.NetStack
101     * @crossplatform
102     * @since 15
103     */
104    ONLY_V6 = 'CURL_IPRESOLVE_V6'
105  }
106
107  /**
108   * Specifies the type and value range of the optional parameters in the HTTP request.
109   * @interface HttpRequestOptions
110   * @syscap SystemCapability.Communication.NetStack
111   * @since 6
112   */
113  /**
114   * Specifies the type and value range of the optional parameters in the HTTP request.
115   * @interface HttpRequestOptions
116   * @syscap SystemCapability.Communication.NetStack
117   * @crossplatform
118   * @since 10
119   */
120  /**
121   * Specifies the type and value range of the optional parameters in the HTTP request.
122   * @interface HttpRequestOptions
123   * @syscap SystemCapability.Communication.NetStack
124   * @crossplatform
125   * @atomicservice
126   * @since 11
127   */
128  export interface HttpRequestOptions {
129    /**
130     * Request method,default is GET.
131     * @type {?RequestMethod}
132     * @syscap SystemCapability.Communication.NetStack
133     * @since 6
134     */
135    /**
136     * Request method,default is GET.
137     * @type {?RequestMethod}
138     * @syscap SystemCapability.Communication.NetStack
139     * @crossplatform
140     * @since 10
141     */
142    /**
143     * Request method,default is GET.
144     * @type {?RequestMethod}
145     * @syscap SystemCapability.Communication.NetStack
146     * @crossplatform
147     * @atomicservice
148     * @since 11
149     */
150    method?: RequestMethod;
151
152    /**
153     * Additional data of the request.
154     * extraData can be a string or an Object (API 6) or an ArrayBuffer(API 8).
155     * @type {?string | Object | ArrayBuffer}
156     * @syscap SystemCapability.Communication.NetStack
157     * @since 6
158     */
159    /**
160     * Additional data of the request.
161     * extraData can be a string or an Object (API 6) or an ArrayBuffer(API 8).
162     * @type {?string | Object | ArrayBuffer}
163     * @syscap SystemCapability.Communication.NetStack
164     * @crossplatform
165     * @since 10
166     */
167    /**
168     * Additional data of the request.
169     * extraData can be a string or an Object (API 6) or an ArrayBuffer(API 8).
170     * @type { ?(string | Object | ArrayBuffer) }
171     * @syscap SystemCapability.Communication.NetStack
172     * @crossplatform
173     * @atomicservice
174     * @since 11
175     */
176    extraData?: string | Object | ArrayBuffer;
177
178    /**
179     * Data type to be returned. If this parameter is set, the system preferentially returns the specified type.
180     * @type {?HttpDataType}
181     * @syscap SystemCapability.Communication.NetStack
182     * @since 9
183     */
184    /**
185     * Data type to be returned. If this parameter is set, the system preferentially returns the specified type.
186     * @type {?HttpDataType}
187     * @syscap SystemCapability.Communication.NetStack
188     * @crossplatform
189     * @since 10
190     */
191    /**
192     * Data type to be returned. If this parameter is set, the system preferentially returns the specified type.
193     * @type {?HttpDataType}
194     * @syscap SystemCapability.Communication.NetStack
195     * @crossplatform
196     * @atomicservice
197     * @since 11
198     */
199    expectDataType?: HttpDataType;
200
201    /**
202     * default is true
203     * @type {?boolean}
204     * @syscap SystemCapability.Communication.NetStack
205     * @since 9
206     */
207    /**
208     * default is true
209     * @type {?boolean}
210     * @syscap SystemCapability.Communication.NetStack
211     * @crossplatform
212     * @since 10
213     */
214    /**
215     * default is true
216     * @type {?boolean}
217     * @syscap SystemCapability.Communication.NetStack
218     * @crossplatform
219     * @atomicservice
220     * @since 11
221     */
222    usingCache?: boolean;
223
224    /**
225     * [1, 1000], default is 1.
226     * @type {?number}
227     * @syscap SystemCapability.Communication.NetStack
228     * @since 9
229     */
230    /**
231     * [1, 1000], default is 1.
232     * @type {?number}
233     * @syscap SystemCapability.Communication.NetStack
234     * @crossplatform
235     * @since 10
236     */
237    /**
238     * [1, 1000], default is 1.
239     * @type {?number}
240     * @syscap SystemCapability.Communication.NetStack
241     * @crossplatform
242     * @atomicservice
243     * @since 11
244     */
245    priority?: number;
246
247    /**
248     * HTTP request header. default is 'content-type': 'application/json'
249     * @type {?Object}
250     * @syscap SystemCapability.Communication.NetStack
251     * @since 6
252     */
253    /**
254     * HTTP request header. default is 'content-type': 'application/json'
255     * @type {?Object}
256     * @syscap SystemCapability.Communication.NetStack
257     * @crossplatform
258     * @since 10
259     */
260    /**
261     * HTTP request header. default is 'content-type': 'application/json'
262     * @type {?Object}
263     * @syscap SystemCapability.Communication.NetStack
264     * @crossplatform
265     * @atomicservice
266     * @since 11
267     */
268    header?: Object;
269
270    /**
271     * Read timeout period. The default value is 60,000, in ms.
272     * @type {?number}
273     * @syscap SystemCapability.Communication.NetStack
274     * @since 6
275     */
276    /**
277     * Read timeout period. The default value is 60,000, in ms.
278     * @type {?number}
279     * @syscap SystemCapability.Communication.NetStack
280     * @crossplatform
281     * @since 10
282     */
283    /**
284     * Read timeout period. The default value is 60,000, in ms.
285     * @type {?number}
286     * @syscap SystemCapability.Communication.NetStack
287     * @crossplatform
288     * @atomicservice
289     * @since 11
290     */
291    readTimeout?: number;
292
293    /**
294     * Connection timeout interval. The default value is 60,000, in ms.
295     * @type {?number}
296     * @syscap SystemCapability.Communication.NetStack
297     * @since 6
298     */
299    /**
300     * Connection timeout interval. The default value is 60,000, in ms.
301     * @type {?number}
302     * @syscap SystemCapability.Communication.NetStack
303     * @crossplatform
304     * @since 10
305     */
306    /**
307     * Connection timeout interval. The default value is 60,000, in ms.
308     * @type {?number}
309     * @syscap SystemCapability.Communication.NetStack
310     * @crossplatform
311     * @atomicservice
312     * @since 11
313     */
314    connectTimeout?: number;
315
316    /**
317     * default is automatically specified by the system.
318     * @type {?HttpProtocol}
319     * @syscap SystemCapability.Communication.NetStack
320     * @since 9
321     */
322    /**
323     * default is automatically specified by the system.
324     * @type {?HttpProtocol}
325     * @syscap SystemCapability.Communication.NetStack
326     * @crossplatform
327     * @since 10
328     */
329    /**
330     * default is automatically specified by the system.
331     * @type {?HttpProtocol}
332     * @syscap SystemCapability.Communication.NetStack
333     * @crossplatform
334     * @atomicservice
335     * @since 11
336     */
337    usingProtocol?: HttpProtocol;
338
339    /**
340     * If this parameter is set as type of boolean, the system will use default proxy or not use proxy.
341     * If this parameter is set as type of HttpProxy, the system will use the specified HttpProxy.
342     * @type {?boolean | HttpProxy}
343     * @syscap SystemCapability.Communication.NetStack
344     * @since 10
345     */
346    /**
347     * If this parameter is set as type of boolean, the system will use default proxy or not use proxy.
348     * If this parameter is set as type of HttpProxy, the system will use the specified HttpProxy.
349     * @type { ?(boolean | HttpProxy) }
350     * @syscap SystemCapability.Communication.NetStack
351     * @atomicservice
352     * @since 11
353     */
354    usingProxy?: boolean | HttpProxy;
355
356    /**
357     * If this parameter is set, the system will use ca path specified by user, or else use preset ca by the system.
358     * @type {?string}
359     * @syscap SystemCapability.Communication.NetStack
360     * @since 10
361     */
362    /**
363     * If this parameter is set, the system will use ca path specified by user, or else use preset ca by the system.
364     * @type {?string}
365     * @syscap SystemCapability.Communication.NetStack
366     * @atomicservice
367     * @since 11
368     */
369    caPath?: string;
370
371    /**
372     * Used to set to uploading or downloading the start bytes. The default value is 0.
373     * HTTP standard (RFC 7233 section 3.1) allows servers to ignore range requests.
374     * For HTTP PUT uploads this option should not be used, since it may conflict with other options.
375     * @type {?number}
376     * @syscap SystemCapability.Communication.NetStack
377     * @since 11
378     */
379    resumeFrom?: number;
380
381    /**
382     * Used to set to uploading or downloading the end bytes. Translate to the end if not set.
383     * HTTP standard (RFC 7233 section 3.1) allows servers to ignore range requests.
384     * For HTTP PUT uploads this option should not be used, since it may conflict with other options.
385     * @type {?number}
386     * @syscap SystemCapability.Communication.NetStack
387     * @since 11
388     */
389    resumeTo?: number;
390
391    /**
392     * Support the application to pass in client certificates, allowing the server to verify the client's identity.
393     * @type {?ClientCert}
394     * @syscap SystemCapability.Communication.NetStack
395     * @since 11
396     */
397    clientCert?: ClientCert;
398
399    /**
400     * If this parameter is set, incoming DNS resolution server URL for the DoH server to use for name resolving.
401     * The parameter must be URL-encoded in the following format: "https://host:port/path".
402     * It MUST specify an HTTPS URL.
403     * @type {?string}
404     * @syscap SystemCapability.Communication.NetStack
405     * @since 11
406     */
407    dnsOverHttps?: string;
408
409    /**
410     * If this parameter is set, use the specified DNS server for DNS resolution.
411     * Multiple DNS resolution servers can be set up, with a maximum of 3 servers.
412     * Only take the first three if there are more than three.
413     * @type {?Array<string>}
414     * @syscap SystemCapability.Communication.NetStack
415     * @since 11
416     */
417    dnsServers?: Array<string>;
418
419    /**
420     * The maximum limit of the response body. The default value is 5 * 1024 * 1024, in Byte.
421     * The maximum value is 100 * 1024 *1024, in Byte.
422     * @type {?number}
423     * @syscap SystemCapability.Communication.NetStack
424     * @since 11
425     */
426    maxLimit?: number;
427
428    /**
429     * The data fields which is supported by the HTTP protocol to post
430     * forms and by the SMTP and IMAP protocols to provide
431     * the email data to send/upload.
432     * @type {?Array<MultiFormData>}
433     * @syscap SystemCapability.Communication.NetStack
434     * @since 11
435     */
436    multiFormDataList?: Array<MultiFormData>;
437
438    /**
439     * Address family option.
440     * @type {AddressFamily}
441     * @syscap SystemCapability.Communication.NetStack
442     * @crossplatform
443     * @since 16
444     */
445    addressFamily?: AddressFamily;
446  }
447
448  /**
449   * Represents the properties of a form object.
450   * @interface MultiFormData
451   * @syscap SystemCapability.Communication.NetStack
452   * @since 11
453   */
454  export interface MultiFormData {
455    /**
456     * MIME name for the data field.
457     * @type {string}
458     * @syscap SystemCapability.Communication.NetStack
459     * @since 11
460     */
461    name: string;
462
463    /**
464     * Content type of the data field.
465     * @type {string}
466     * @syscap SystemCapability.Communication.NetStack
467     * @since 11
468     */
469    contentType: string;
470
471    /**
472     * Remote file name for the data field.
473     * @type {?string}
474     * @syscap SystemCapability.Communication.NetStack
475     * @since 11
476     */
477    remoteFileName?: string;
478
479    /**
480     * This parameter sets a mime part's body content from memory data.
481     * @type {?(string | Object | ArrayBuffer)}
482     * @syscap SystemCapability.Communication.NetStack
483     * @since 11
484     */
485    data?: string | Object | ArrayBuffer;
486
487    /**
488     * This parameter sets a mime part's body content from the file's contents.
489     * This is an alternative to curl_mime_data for setting data to a mime part.
490     * If data is empty, filePath must be set.
491     * If data has a value, filePath does not take effect.
492     * @type {?string}
493     * @syscap SystemCapability.Communication.NetStack
494     * @since 11
495     */
496    filePath?: string;
497  }
498
499  /**
500   * Enum for certificate types
501   * @enum {string}
502   * @syscap SystemCapability.Communication.NetStack
503   * @since 11
504   */
505  export enum CertType {
506    /**
507     * PEM format certificate
508     * @syscap SystemCapability.Communication.NetStack
509     * @since 11
510     */
511    PEM = 'PEM',
512
513    /**
514     * DER format certificate
515     * @syscap SystemCapability.Communication.NetStack
516     * @since 11
517     */
518    DER = 'DER',
519
520    /**
521     * P12 format certificate
522     * @syscap SystemCapability.Communication.NetStack
523     * @since 11
524     */
525    P12 = 'P12'
526  }
527
528  /**
529   * The clientCert field of the client certificate, which includes 4 attributes:
530   * client certificate (cert), client certificate type (certType), certificate private key (key), and passphrase (keyPassword).
531   * @interface ClientCert
532   * @syscap SystemCapability.Communication.NetStack
533   * @since 11
534   */
535  export interface ClientCert {
536    /**
537     * The path to the client certificate file.
538     * @type {string}
539     * @syscap SystemCapability.Communication.NetStack
540     * @since 11
541     */
542    certPath: string;
543
544    /**
545     * The type of the client certificate.
546     * @type {?CertType}
547     * @syscap SystemCapability.Communication.NetStack
548     * @since 11
549     */
550    certType?: CertType;
551
552    /**
553     * The path of the client certificate private key file.
554     * @type {string}
555     * @syscap SystemCapability.Communication.NetStack
556     * @since 11
557     */
558    keyPath: string;
559
560    /**
561     * Password required to use the client certificate private key.
562     * @type {?string}
563     * @syscap SystemCapability.Communication.NetStack
564     * @since 11
565     */
566    keyPassword?: string;
567  }
568
569  /**
570   * <p>Defines an HTTP request task. Before invoking APIs provided by HttpRequest,
571   * you must call createHttp() to create an HttpRequestTask object.</p>
572   * @interface HttpRequest
573   * @syscap SystemCapability.Communication.NetStack
574   * @since 6
575   */
576  /**
577   * <p>Defines an HTTP request task. Before invoking APIs provided by HttpRequest,
578   * you must call createHttp() to create an HttpRequestTask object.</p>
579   * @interface HttpRequest
580   * @syscap SystemCapability.Communication.NetStack
581   * @crossplatform
582   * @since 10
583   */
584  /**
585   * <p>Defines an HTTP request task. Before invoking APIs provided by HttpRequest,
586   * you must call createHttp() to create an HttpRequestTask object.</p>
587   * @interface HttpRequest
588   * @syscap SystemCapability.Communication.NetStack
589   * @crossplatform
590   * @atomicservice
591   * @since 11
592   */
593  export interface HttpRequest {
594    /**
595     * Initiates an HTTP request to a given URL.
596     * @permission ohos.permission.INTERNET
597     * @param { string } url - URL for initiating an HTTP request.
598     * @param { AsyncCallback<HttpResponse> } callback - the callback of request.
599     * @throws { BusinessError } 401 - Parameter error.
600     * @throws { BusinessError } 201 - Permission denied.
601     * @throws { BusinessError } 2300001 - Unsupported protocol.
602     * @throws { BusinessError } 2300003 - URL using bad/illegal format or missing URL.
603     * @throws { BusinessError } 2300005 - Couldn't resolve proxy name.
604     * @throws { BusinessError } 2300006 - Couldn't resolve host name.
605     * @throws { BusinessError } 2300007 - Couldn't connect to server.
606     * @throws { BusinessError } 2300008 - Weird server reply.
607     * @throws { BusinessError } 2300009 - Access denied to remote resource.
608     * @throws { BusinessError } 2300016 - Error in the HTTP2 framing layer.
609     * @throws { BusinessError } 2300018 - Transferred a partial file.
610     * @throws { BusinessError } 2300023 - Failed writing received data to disk/application.
611     * @throws { BusinessError } 2300025 - Upload failed.
612     * @throws { BusinessError } 2300026 - Failed to open/read local data from file/application.
613     * @throws { BusinessError } 2300027 - Out of memory.
614     * @throws { BusinessError } 2300028 - Timeout was reached.
615     * @throws { BusinessError } 2300047 - Number of redirects hit maximum amount.
616     * @throws { BusinessError } 2300052 - Server returned nothing (no headers, no data).
617     * @throws { BusinessError } 2300055 - Failed sending data to the peer.
618     * @throws { BusinessError } 2300056 - Failure when receiving data from the peer.
619     * @throws { BusinessError } 2300058 - Problem with the local SSL certificate.
620     * @throws { BusinessError } 2300059 - Couldn't use specified SSL cipher.
621     * @throws { BusinessError } 2300060 - SSL peer certificate or SSH remote key was not OK.
622     * @throws { BusinessError } 2300061 - Unrecognized or bad HTTP Content or Transfer-Encoding.
623     * @throws { BusinessError } 2300063 - Maximum file size exceeded.
624     * @throws { BusinessError } 2300070 - Disk full or allocation exceeded.
625     * @throws { BusinessError } 2300073 - Remote file already exists.
626     * @throws { BusinessError } 2300077 - Problem with the SSL CA cert (path? access rights?).
627     * @throws { BusinessError } 2300078 - Remote file not found.
628     * @throws { BusinessError } 2300094 - An authentication function returned an error.
629     * @throws { BusinessError } 2300999 - Unknown Other Error.
630     * @syscap SystemCapability.Communication.NetStack
631     * @since 6
632     */
633    /**
634     * Initiates an HTTP request to a given URL.
635     * @permission ohos.permission.INTERNET
636     * @param { string } url - URL for initiating an HTTP request.
637     * @param { AsyncCallback<HttpResponse> } callback - the callback of request.
638     * @throws { BusinessError } 401 - Parameter error.
639     * @throws { BusinessError } 201 - Permission denied.
640     * @throws { BusinessError } 2300001 - Unsupported protocol.
641     * @throws { BusinessError } 2300003 - URL using bad/illegal format or missing URL.
642     * @throws { BusinessError } 2300005 - Couldn't resolve proxy name.
643     * @throws { BusinessError } 2300006 - Couldn't resolve host name.
644     * @throws { BusinessError } 2300007 - Couldn't connect to server.
645     * @throws { BusinessError } 2300008 - Weird server reply.
646     * @throws { BusinessError } 2300009 - Access denied to remote resource.
647     * @throws { BusinessError } 2300016 - Error in the HTTP2 framing layer.
648     * @throws { BusinessError } 2300018 - Transferred a partial file.
649     * @throws { BusinessError } 2300023 - Failed writing received data to disk/application.
650     * @throws { BusinessError } 2300025 - Upload failed.
651     * @throws { BusinessError } 2300026 - Failed to open/read local data from file/application.
652     * @throws { BusinessError } 2300027 - Out of memory.
653     * @throws { BusinessError } 2300028 - Timeout was reached.
654     * @throws { BusinessError } 2300047 - Number of redirects hit maximum amount.
655     * @throws { BusinessError } 2300052 - Server returned nothing (no headers, no data).
656     * @throws { BusinessError } 2300055 - Failed sending data to the peer.
657     * @throws { BusinessError } 2300056 - Failure when receiving data from the peer.
658     * @throws { BusinessError } 2300058 - Problem with the local SSL certificate.
659     * @throws { BusinessError } 2300059 - Couldn't use specified SSL cipher.
660     * @throws { BusinessError } 2300060 - SSL peer certificate or SSH remote key was not OK.
661     * @throws { BusinessError } 2300061 - Unrecognized or bad HTTP Content or Transfer-Encoding.
662     * @throws { BusinessError } 2300063 - Maximum file size exceeded.
663     * @throws { BusinessError } 2300070 - Disk full or allocation exceeded.
664     * @throws { BusinessError } 2300073 - Remote file already exists.
665     * @throws { BusinessError } 2300077 - Problem with the SSL CA cert (path? access rights?).
666     * @throws { BusinessError } 2300078 - Remote file not found.
667     * @throws { BusinessError } 2300094 - An authentication function returned an error.
668     * @throws { BusinessError } 2300999 - Unknown Other Error.
669     * @syscap SystemCapability.Communication.NetStack
670     * @crossplatform
671     * @since 10
672     */
673    /**
674     * Initiates an HTTP request to a given URL.
675     * @permission ohos.permission.INTERNET
676     * @param { string } url - URL for initiating an HTTP request.
677     * @param { AsyncCallback<HttpResponse> } callback - the callback of request.
678     * @throws { BusinessError } 401 - Parameter error.
679     * @throws { BusinessError } 201 - Permission denied.
680     * @throws { BusinessError } 2300001 - Unsupported protocol.
681     * @throws { BusinessError } 2300003 - URL using bad/illegal format or missing URL.
682     * @throws { BusinessError } 2300005 - Couldn't resolve proxy name.
683     * @throws { BusinessError } 2300006 - Couldn't resolve host name.
684     * @throws { BusinessError } 2300007 - Couldn't connect to server.
685     * @throws { BusinessError } 2300008 - Weird server reply.
686     * @throws { BusinessError } 2300009 - Access denied to remote resource.
687     * @throws { BusinessError } 2300016 - Error in the HTTP2 framing layer.
688     * @throws { BusinessError } 2300018 - Transferred a partial file.
689     * @throws { BusinessError } 2300023 - Failed writing received data to disk/application.
690     * @throws { BusinessError } 2300025 - Upload failed.
691     * @throws { BusinessError } 2300026 - Failed to open/read local data from file/application.
692     * @throws { BusinessError } 2300027 - Out of memory.
693     * @throws { BusinessError } 2300028 - Timeout was reached.
694     * @throws { BusinessError } 2300047 - Number of redirects hit maximum amount.
695     * @throws { BusinessError } 2300052 - Server returned nothing (no headers, no data).
696     * @throws { BusinessError } 2300055 - Failed sending data to the peer.
697     * @throws { BusinessError } 2300056 - Failure when receiving data from the peer.
698     * @throws { BusinessError } 2300058 - Problem with the local SSL certificate.
699     * @throws { BusinessError } 2300059 - Couldn't use specified SSL cipher.
700     * @throws { BusinessError } 2300060 - SSL peer certificate or SSH remote key was not OK.
701     * @throws { BusinessError } 2300061 - Unrecognized or bad HTTP Content or Transfer-Encoding.
702     * @throws { BusinessError } 2300063 - Maximum file size exceeded.
703     * @throws { BusinessError } 2300070 - Disk full or allocation exceeded.
704     * @throws { BusinessError } 2300073 - Remote file already exists.
705     * @throws { BusinessError } 2300077 - Problem with the SSL CA cert (path? access rights?).
706     * @throws { BusinessError } 2300078 - Remote file not found.
707     * @throws { BusinessError } 2300094 - An authentication function returned an error.
708     * @throws { BusinessError } 2300999 - Unknown Other Error.
709     * @syscap SystemCapability.Communication.NetStack
710     * @crossplatform
711     * @atomicservice
712     * @since 11
713     */
714    request(url: string, callback: AsyncCallback<HttpResponse>): void;
715
716    /**
717     * Initiates an HTTP request to a given URL.
718     * @permission ohos.permission.INTERNET
719     * @param { string } url - URL for initiating an HTTP request.
720     * @param { HttpRequestOptions } options - Optional parameters {@link HttpRequestOptions}.
721     * @param { AsyncCallback<HttpResponse> } callback - the callback of request..
722     * @throws { BusinessError } 401 - Parameter error.
723     * @throws { BusinessError } 201 - Permission denied.
724     * @throws { BusinessError } 2300001 - Unsupported protocol.
725     * @throws { BusinessError } 2300003 - URL using bad/illegal format or missing URL.
726     * @throws { BusinessError } 2300005 - Couldn't resolve proxy name.
727     * @throws { BusinessError } 2300006 - Couldn't resolve host name.
728     * @throws { BusinessError } 2300007 - Couldn't connect to server.
729     * @throws { BusinessError } 2300008 - Weird server reply.
730     * @throws { BusinessError } 2300009 - Access denied to remote resource.
731     * @throws { BusinessError } 2300016 - Error in the HTTP2 framing layer.
732     * @throws { BusinessError } 2300018 - Transferred a partial file.
733     * @throws { BusinessError } 2300023 - Failed writing received data to disk/application.
734     * @throws { BusinessError } 2300025 - Upload failed.
735     * @throws { BusinessError } 2300026 - Failed to open/read local data from file/application.
736     * @throws { BusinessError } 2300027 - Out of memory.
737     * @throws { BusinessError } 2300028 - Timeout was reached.
738     * @throws { BusinessError } 2300047 - Number of redirects hit maximum amount.
739     * @throws { BusinessError } 2300052 - Server returned nothing (no headers, no data).
740     * @throws { BusinessError } 2300055 - Failed sending data to the peer.
741     * @throws { BusinessError } 2300056 - Failure when receiving data from the peer.
742     * @throws { BusinessError } 2300058 - Problem with the local SSL certificate.
743     * @throws { BusinessError } 2300059 - Couldn't use specified SSL cipher.
744     * @throws { BusinessError } 2300060 - SSL peer certificate or SSH remote key was not OK.
745     * @throws { BusinessError } 2300061 - Unrecognized or bad HTTP Content or Transfer-Encoding.
746     * @throws { BusinessError } 2300063 - Maximum file size exceeded.
747     * @throws { BusinessError } 2300070 - Disk full or allocation exceeded.
748     * @throws { BusinessError } 2300073 - Remote file already exists.
749     * @throws { BusinessError } 2300077 - Problem with the SSL CA cert (path? access rights?).
750     * @throws { BusinessError } 2300078 - Remote file not found.
751     * @throws { BusinessError } 2300094 - An authentication function returned an error.
752     * @throws { BusinessError } 2300999 - Unknown Other Error.
753     * @syscap SystemCapability.Communication.NetStack
754     * @since 6
755     */
756    /**
757     * Initiates an HTTP request to a given URL.
758     * @permission ohos.permission.INTERNET
759     * @param { string } url - URL for initiating an HTTP request.
760     * @param { HttpRequestOptions } options - Optional parameters {@link HttpRequestOptions}.
761     * @param { AsyncCallback<HttpResponse> } callback - the callback of request.
762     * @throws { BusinessError } 401 - Parameter error.
763     * @throws { BusinessError } 201 - Permission denied.
764     * @throws { BusinessError } 2300001 - Unsupported protocol.
765     * @throws { BusinessError } 2300003 - URL using bad/illegal format or missing URL.
766     * @throws { BusinessError } 2300005 - Couldn't resolve proxy name.
767     * @throws { BusinessError } 2300006 - Couldn't resolve host name.
768     * @throws { BusinessError } 2300007 - Couldn't connect to server.
769     * @throws { BusinessError } 2300008 - Weird server reply.
770     * @throws { BusinessError } 2300009 - Access denied to remote resource.
771     * @throws { BusinessError } 2300016 - Error in the HTTP2 framing layer.
772     * @throws { BusinessError } 2300018 - Transferred a partial file.
773     * @throws { BusinessError } 2300023 - Failed writing received data to disk/application.
774     * @throws { BusinessError } 2300025 - Upload failed.
775     * @throws { BusinessError } 2300026 - Failed to open/read local data from file/application.
776     * @throws { BusinessError } 2300027 - Out of memory.
777     * @throws { BusinessError } 2300028 - Timeout was reached.
778     * @throws { BusinessError } 2300047 - Number of redirects hit maximum amount.
779     * @throws { BusinessError } 2300052 - Server returned nothing (no headers, no data).
780     * @throws { BusinessError } 2300055 - Failed sending data to the peer.
781     * @throws { BusinessError } 2300056 - Failure when receiving data from the peer.
782     * @throws { BusinessError } 2300058 - Problem with the local SSL certificate.
783     * @throws { BusinessError } 2300059 - Couldn't use specified SSL cipher.
784     * @throws { BusinessError } 2300060 - SSL peer certificate or SSH remote key was not OK.
785     * @throws { BusinessError } 2300061 - Unrecognized or bad HTTP Content or Transfer-Encoding.
786     * @throws { BusinessError } 2300063 - Maximum file size exceeded.
787     * @throws { BusinessError } 2300070 - Disk full or allocation exceeded.
788     * @throws { BusinessError } 2300073 - Remote file already exists.
789     * @throws { BusinessError } 2300077 - Problem with the SSL CA cert (path? access rights?).
790     * @throws { BusinessError } 2300078 - Remote file not found.
791     * @throws { BusinessError } 2300094 - An authentication function returned an error.
792     * @throws { BusinessError } 2300999 - Unknown Other Error.
793     * @syscap SystemCapability.Communication.NetStack
794     * @crossplatform
795     * @since 10
796     */
797    /**
798     * Initiates an HTTP request to a given URL.
799     * @permission ohos.permission.INTERNET
800     * @param { string } url - URL for initiating an HTTP request.
801     * @param { HttpRequestOptions } options - Optional parameters {@link HttpRequestOptions}.
802     * @param { AsyncCallback<HttpResponse> } callback - the callback of request.
803     * @throws { BusinessError } 401 - Parameter error.
804     * @throws { BusinessError } 201 - Permission denied.
805     * @throws { BusinessError } 2300001 - Unsupported protocol.
806     * @throws { BusinessError } 2300003 - URL using bad/illegal format or missing URL.
807     * @throws { BusinessError } 2300005 - Couldn't resolve proxy name.
808     * @throws { BusinessError } 2300006 - Couldn't resolve host name.
809     * @throws { BusinessError } 2300007 - Couldn't connect to server.
810     * @throws { BusinessError } 2300008 - Weird server reply.
811     * @throws { BusinessError } 2300009 - Access denied to remote resource.
812     * @throws { BusinessError } 2300016 - Error in the HTTP2 framing layer.
813     * @throws { BusinessError } 2300018 - Transferred a partial file.
814     * @throws { BusinessError } 2300023 - Failed writing received data to disk/application.
815     * @throws { BusinessError } 2300025 - Upload failed.
816     * @throws { BusinessError } 2300026 - Failed to open/read local data from file/application.
817     * @throws { BusinessError } 2300027 - Out of memory.
818     * @throws { BusinessError } 2300028 - Timeout was reached.
819     * @throws { BusinessError } 2300047 - Number of redirects hit maximum amount.
820     * @throws { BusinessError } 2300052 - Server returned nothing (no headers, no data).
821     * @throws { BusinessError } 2300055 - Failed sending data to the peer.
822     * @throws { BusinessError } 2300056 - Failure when receiving data from the peer.
823     * @throws { BusinessError } 2300058 - Problem with the local SSL certificate.
824     * @throws { BusinessError } 2300059 - Couldn't use specified SSL cipher.
825     * @throws { BusinessError } 2300060 - SSL peer certificate or SSH remote key was not OK.
826     * @throws { BusinessError } 2300061 - Unrecognized or bad HTTP Content or Transfer-Encoding.
827     * @throws { BusinessError } 2300063 - Maximum file size exceeded.
828     * @throws { BusinessError } 2300070 - Disk full or allocation exceeded.
829     * @throws { BusinessError } 2300073 - Remote file already exists.
830     * @throws { BusinessError } 2300077 - Problem with the SSL CA cert (path? access rights?).
831     * @throws { BusinessError } 2300078 - Remote file not found.
832     * @throws { BusinessError } 2300094 - An authentication function returned an error.
833     * @throws { BusinessError } 2300999 - Unknown Other Error.
834     * @syscap SystemCapability.Communication.NetStack
835     * @crossplatform
836     * @atomicservice
837     * @since 11
838     */
839    request(url: string, options: HttpRequestOptions, callback: AsyncCallback<HttpResponse>): void;
840
841    /**
842     * Initiates an HTTP request to a given URL.
843     * @permission ohos.permission.INTERNET
844     * @param { string } url - URL for initiating an HTTP request.
845     * @param { HttpRequestOptions } options - Optional parameters {@link HttpRequestOptions}.
846     * @returns { Promise<HttpResponse> } The promise returned by the function.
847     * @throws { BusinessError } 401 - Parameter error.
848     * @throws { BusinessError } 201 - Permission denied.
849     * @throws { BusinessError } 2300001 - Unsupported protocol.
850     * @throws { BusinessError } 2300003 - URL using bad/illegal format or missing URL.
851     * @throws { BusinessError } 2300005 - Couldn't resolve proxy name.
852     * @throws { BusinessError } 2300006 - Couldn't resolve host name.
853     * @throws { BusinessError } 2300007 - Couldn't connect to server.
854     * @throws { BusinessError } 2300008 - Weird server reply.
855     * @throws { BusinessError } 2300009 - Access denied to remote resource.
856     * @throws { BusinessError } 2300016 - Error in the HTTP2 framing layer.
857     * @throws { BusinessError } 2300018 - Transferred a partial file.
858     * @throws { BusinessError } 2300023 - Failed writing received data to disk/application.
859     * @throws { BusinessError } 2300025 - Upload failed.
860     * @throws { BusinessError } 2300026 - Failed to open/read local data from file/application.
861     * @throws { BusinessError } 2300027 - Out of memory.
862     * @throws { BusinessError } 2300028 - Timeout was reached.
863     * @throws { BusinessError } 2300047 - Number of redirects hit maximum amount.
864     * @throws { BusinessError } 2300052 - Server returned nothing (no headers, no data).
865     * @throws { BusinessError } 2300055 - Failed sending data to the peer.
866     * @throws { BusinessError } 2300056 - Failure when receiving data from the peer.
867     * @throws { BusinessError } 2300058 - Problem with the local SSL certificate.
868     * @throws { BusinessError } 2300059 - Couldn't use specified SSL cipher.
869     * @throws { BusinessError } 2300060 - SSL peer certificate or SSH remote key was not OK.
870     * @throws { BusinessError } 2300061 - Unrecognized or bad HTTP Content or Transfer-Encoding.
871     * @throws { BusinessError } 2300063 - Maximum file size exceeded.
872     * @throws { BusinessError } 2300070 - Disk full or allocation exceeded.
873     * @throws { BusinessError } 2300073 - Remote file already exists.
874     * @throws { BusinessError } 2300077 - Problem with the SSL CA cert (path? access rights?).
875     * @throws { BusinessError } 2300078 - Remote file not found.
876     * @throws { BusinessError } 2300094 - An authentication function returned an error.
877     * @throws { BusinessError } 2300999 - Unknown Other Error.
878     * @syscap SystemCapability.Communication.NetStack
879     * @since 6
880     */
881    /**
882     * Initiates an HTTP request to a given URL.
883     * @permission ohos.permission.INTERNET
884     * @param { string } url - URL for initiating an HTTP request.
885     * @param { HttpRequestOptions } options - Optional parameters {@link HttpRequestOptions}.
886     * @returns { Promise<HttpResponse> } The promise returned by the function.
887     * @throws { BusinessError } 401 - Parameter error.
888     * @throws { BusinessError } 201 - Permission denied.
889     * @throws { BusinessError } 2300001 - Unsupported protocol.
890     * @throws { BusinessError } 2300003 - URL using bad/illegal format or missing URL.
891     * @throws { BusinessError } 2300005 - Couldn't resolve proxy name.
892     * @throws { BusinessError } 2300006 - Couldn't resolve host name.
893     * @throws { BusinessError } 2300007 - Couldn't connect to server.
894     * @throws { BusinessError } 2300008 - Weird server reply.
895     * @throws { BusinessError } 2300009 - Access denied to remote resource.
896     * @throws { BusinessError } 2300016 - Error in the HTTP2 framing layer.
897     * @throws { BusinessError } 2300018 - Transferred a partial file.
898     * @throws { BusinessError } 2300023 - Failed writing received data to disk/application.
899     * @throws { BusinessError } 2300025 - Upload failed.
900     * @throws { BusinessError } 2300026 - Failed to open/read local data from file/application.
901     * @throws { BusinessError } 2300027 - Out of memory.
902     * @throws { BusinessError } 2300028 - Timeout was reached.
903     * @throws { BusinessError } 2300047 - Number of redirects hit maximum amount.
904     * @throws { BusinessError } 2300052 - Server returned nothing (no headers, no data).
905     * @throws { BusinessError } 2300055 - Failed sending data to the peer.
906     * @throws { BusinessError } 2300056 - Failure when receiving data from the peer.
907     * @throws { BusinessError } 2300058 - Problem with the local SSL certificate.
908     * @throws { BusinessError } 2300059 - Couldn't use specified SSL cipher.
909     * @throws { BusinessError } 2300060 - SSL peer certificate or SSH remote key was not OK.
910     * @throws { BusinessError } 2300061 - Unrecognized or bad HTTP Content or Transfer-Encoding.
911     * @throws { BusinessError } 2300063 - Maximum file size exceeded.
912     * @throws { BusinessError } 2300070 - Disk full or allocation exceeded.
913     * @throws { BusinessError } 2300073 - Remote file already exists.
914     * @throws { BusinessError } 2300077 - Problem with the SSL CA cert (path? access rights?).
915     * @throws { BusinessError } 2300078 - Remote file not found.
916     * @throws { BusinessError } 2300094 - An authentication function returned an error.
917     * @throws { BusinessError } 2300999 - Unknown Other Error.
918     * @syscap SystemCapability.Communication.NetStack
919     * @crossplatform
920     * @since 10
921     */
922    /**
923     * Initiates an HTTP request to a given URL.
924     * @permission ohos.permission.INTERNET
925     * @param { string } url - URL for initiating an HTTP request.
926     * @param { HttpRequestOptions } options - Optional parameters {@link HttpRequestOptions}.
927     * @returns { Promise<HttpResponse> } The promise returned by the function.
928     * @throws { BusinessError } 401 - Parameter error.
929     * @throws { BusinessError } 201 - Permission denied.
930     * @throws { BusinessError } 2300001 - Unsupported protocol.
931     * @throws { BusinessError } 2300003 - URL using bad/illegal format or missing URL.
932     * @throws { BusinessError } 2300005 - Couldn't resolve proxy name.
933     * @throws { BusinessError } 2300006 - Couldn't resolve host name.
934     * @throws { BusinessError } 2300007 - Couldn't connect to server.
935     * @throws { BusinessError } 2300008 - Weird server reply.
936     * @throws { BusinessError } 2300009 - Access denied to remote resource.
937     * @throws { BusinessError } 2300016 - Error in the HTTP2 framing layer.
938     * @throws { BusinessError } 2300018 - Transferred a partial file.
939     * @throws { BusinessError } 2300023 - Failed writing received data to disk/application.
940     * @throws { BusinessError } 2300025 - Upload failed.
941     * @throws { BusinessError } 2300026 - Failed to open/read local data from file/application.
942     * @throws { BusinessError } 2300027 - Out of memory.
943     * @throws { BusinessError } 2300028 - Timeout was reached.
944     * @throws { BusinessError } 2300047 - Number of redirects hit maximum amount.
945     * @throws { BusinessError } 2300052 - Server returned nothing (no headers, no data).
946     * @throws { BusinessError } 2300055 - Failed sending data to the peer.
947     * @throws { BusinessError } 2300056 - Failure when receiving data from the peer.
948     * @throws { BusinessError } 2300058 - Problem with the local SSL certificate.
949     * @throws { BusinessError } 2300059 - Couldn't use specified SSL cipher.
950     * @throws { BusinessError } 2300060 - SSL peer certificate or SSH remote key was not OK.
951     * @throws { BusinessError } 2300061 - Unrecognized or bad HTTP Content or Transfer-Encoding.
952     * @throws { BusinessError } 2300063 - Maximum file size exceeded.
953     * @throws { BusinessError } 2300070 - Disk full or allocation exceeded.
954     * @throws { BusinessError } 2300073 - Remote file already exists.
955     * @throws { BusinessError } 2300077 - Problem with the SSL CA cert (path? access rights?).
956     * @throws { BusinessError } 2300078 - Remote file not found.
957     * @throws { BusinessError } 2300094 - An authentication function returned an error.
958     * @throws { BusinessError } 2300999 - Unknown Other Error.
959     * @syscap SystemCapability.Communication.NetStack
960     * @crossplatform
961     * @atomicservice
962     * @since 11
963     */
964    request(url: string, options?: HttpRequestOptions): Promise<HttpResponse>;
965
966    /**
967     * Initiates an HTTP request to a given URL, applicable to scenarios where http response supports streaming.
968     * @permission ohos.permission.INTERNET
969     * @param { string } url - URL for initiating an HTTP request.
970     * @param { AsyncCallback<number> } callback - Returns the callback of requestInStream {@link ResponseCode},
971     * should use on_headersReceive and on_dataReceive to get http response.
972     * @throws { BusinessError } 401 - Parameter error.
973     * @throws { BusinessError } 201 - Permission denied.
974     * @throws { BusinessError } 2300001 - Unsupported protocol.
975     * @throws { BusinessError } 2300003 - URL using bad/illegal format or missing URL.
976     * @throws { BusinessError } 2300005 - Couldn't resolve proxy name.
977     * @throws { BusinessError } 2300006 - Couldn't resolve host name.
978     * @throws { BusinessError } 2300007 - Couldn't connect to server.
979     * @throws { BusinessError } 2300008 - Weird server reply.
980     * @throws { BusinessError } 2300009 - Access denied to remote resource.
981     * @throws { BusinessError } 2300016 - Error in the HTTP2 framing layer.
982     * @throws { BusinessError } 2300018 - Transferred a partial file.
983     * @throws { BusinessError } 2300023 - Failed writing received data to disk/application.
984     * @throws { BusinessError } 2300025 - Upload failed.
985     * @throws { BusinessError } 2300026 - Failed to open/read local data from file/application.
986     * @throws { BusinessError } 2300027 - Out of memory.
987     * @throws { BusinessError } 2300028 - Timeout was reached.
988     * @throws { BusinessError } 2300047 - Number of redirects hit maximum amount.
989     * @throws { BusinessError } 2300052 - Server returned nothing (no headers, no data).
990     * @throws { BusinessError } 2300055 - Failed sending data to the peer.
991     * @throws { BusinessError } 2300056 - Failure when receiving data from the peer.
992     * @throws { BusinessError } 2300058 - Problem with the local SSL certificate.
993     * @throws { BusinessError } 2300059 - Couldn't use specified SSL cipher.
994     * @throws { BusinessError } 2300060 - SSL peer certificate or SSH remote key was not OK.
995     * @throws { BusinessError } 2300061 - Unrecognized or bad HTTP Content or Transfer-Encoding.
996     * @throws { BusinessError } 2300063 - Maximum file size exceeded.
997     * @throws { BusinessError } 2300070 - Disk full or allocation exceeded.
998     * @throws { BusinessError } 2300073 - Remote file already exists.
999     * @throws { BusinessError } 2300077 - Problem with the SSL CA cert (path? access rights?).
1000     * @throws { BusinessError } 2300078 - Remote file not found.
1001     * @throws { BusinessError } 2300094 - An authentication function returned an error.
1002     * @throws { BusinessError } 2300999 - Unknown Other Error.
1003     * @syscap SystemCapability.Communication.NetStack
1004     * @since 10
1005     */
1006    requestInStream(url: string, callback: AsyncCallback<number>): void;
1007
1008    /**
1009     * Initiates an HTTP request to a given URL, applicable to scenarios where http response supports streaming.
1010     * @permission ohos.permission.INTERNET
1011     * @param { string } url - URL for initiating an HTTP request.
1012     * @param { HttpRequestOptions } options - Optional parameters {@link HttpRequestOptions}.
1013     * @param { AsyncCallback<number> } callback - the callback of requestInStream.
1014     * @throws { BusinessError } 401 - Parameter error.
1015     * @throws { BusinessError } 201 - Permission denied.
1016     * @throws { BusinessError } 2300001 - Unsupported protocol.
1017     * @throws { BusinessError } 2300003 - URL using bad/illegal format or missing URL.
1018     * @throws { BusinessError } 2300005 - Couldn't resolve proxy name.
1019     * @throws { BusinessError } 2300006 - Couldn't resolve host name.
1020     * @throws { BusinessError } 2300007 - Couldn't connect to server.
1021     * @throws { BusinessError } 2300008 - Weird server reply.
1022     * @throws { BusinessError } 2300009 - Access denied to remote resource.
1023     * @throws { BusinessError } 2300016 - Error in the HTTP2 framing layer.
1024     * @throws { BusinessError } 2300018 - Transferred a partial file.
1025     * @throws { BusinessError } 2300023 - Failed writing received data to disk/application.
1026     * @throws { BusinessError } 2300025 - Upload failed.
1027     * @throws { BusinessError } 2300026 - Failed to open/read local data from file/application.
1028     * @throws { BusinessError } 2300027 - Out of memory.
1029     * @throws { BusinessError } 2300028 - Timeout was reached.
1030     * @throws { BusinessError } 2300047 - Number of redirects hit maximum amount.
1031     * @throws { BusinessError } 2300052 - Server returned nothing (no headers, no data).
1032     * @throws { BusinessError } 2300055 - Failed sending data to the peer.
1033     * @throws { BusinessError } 2300056 - Failure when receiving data from the peer.
1034     * @throws { BusinessError } 2300058 - Problem with the local SSL certificate.
1035     * @throws { BusinessError } 2300059 - Couldn't use specified SSL cipher.
1036     * @throws { BusinessError } 2300060 - SSL peer certificate or SSH remote key was not OK.
1037     * @throws { BusinessError } 2300061 - Unrecognized or bad HTTP Content or Transfer-Encoding.
1038     * @throws { BusinessError } 2300063 - Maximum file size exceeded.
1039     * @throws { BusinessError } 2300070 - Disk full or allocation exceeded.
1040     * @throws { BusinessError } 2300073 - Remote file already exists.
1041     * @throws { BusinessError } 2300077 - Problem with the SSL CA cert (path? access rights?).
1042     * @throws { BusinessError } 2300078 - Remote file not found.
1043     * @throws { BusinessError } 2300094 - An authentication function returned an error.
1044     * @throws { BusinessError } 2300999 - Unknown Other Error.
1045     * @syscap SystemCapability.Communication.NetStack
1046     * @since 10
1047     */
1048    requestInStream(url: string, options: HttpRequestOptions, callback: AsyncCallback<number>): void;
1049
1050    /**
1051     * Initiates an HTTP request to a given URL, applicable to scenarios where http response supports streaming.
1052     * @permission ohos.permission.INTERNET
1053     * @param { string } url - URL for initiating an HTTP request.
1054     * @param { HttpRequestOptions } options - Optional parameters {@link HttpRequestOptions}.
1055     * @returns { Promise<number> } the promise returned by the function.
1056     * @throws { BusinessError } 401 - Parameter error.
1057     * @throws { BusinessError } 201 - Permission denied.
1058     * @throws { BusinessError } 2300001 - Unsupported protocol.
1059     * @throws { BusinessError } 2300003 - URL using bad/illegal format or missing URL.
1060     * @throws { BusinessError } 2300005 - Couldn't resolve proxy name.
1061     * @throws { BusinessError } 2300006 - Couldn't resolve host name.
1062     * @throws { BusinessError } 2300007 - Couldn't connect to server.
1063     * @throws { BusinessError } 2300008 - Weird server reply.
1064     * @throws { BusinessError } 2300009 - Access denied to remote resource.
1065     * @throws { BusinessError } 2300016 - Error in the HTTP2 framing layer.
1066     * @throws { BusinessError } 2300018 - Transferred a partial file.
1067     * @throws { BusinessError } 2300023 - Failed writing received data to disk/application.
1068     * @throws { BusinessError } 2300025 - Upload failed.
1069     * @throws { BusinessError } 2300026 - Failed to open/read local data from file/application.
1070     * @throws { BusinessError } 2300027 - Out of memory.
1071     * @throws { BusinessError } 2300028 - Timeout was reached.
1072     * @throws { BusinessError } 2300047 - Number of redirects hit maximum amount.
1073     * @throws { BusinessError } 2300052 - Server returned nothing (no headers, no data).
1074     * @throws { BusinessError } 2300055 - Failed sending data to the peer.
1075     * @throws { BusinessError } 2300056 - Failure when receiving data from the peer.
1076     * @throws { BusinessError } 2300058 - Problem with the local SSL certificate.
1077     * @throws { BusinessError } 2300059 - Couldn't use specified SSL cipher.
1078     * @throws { BusinessError } 2300060 - SSL peer certificate or SSH remote key was not OK.
1079     * @throws { BusinessError } 2300061 - Unrecognized or bad HTTP Content or Transfer-Encoding.
1080     * @throws { BusinessError } 2300063 - Maximum file size exceeded.
1081     * @throws { BusinessError } 2300070 - Disk full or allocation exceeded.
1082     * @throws { BusinessError } 2300073 - Remote file already exists.
1083     * @throws { BusinessError } 2300077 - Problem with the SSL CA cert (path? access rights?).
1084     * @throws { BusinessError } 2300078 - Remote file not found.
1085     * @throws { BusinessError } 2300094 - An authentication function returned an error.
1086     * @throws { BusinessError } 2300999 - Unknown Other Error.
1087     * @syscap SystemCapability.Communication.NetStack
1088     * @since 10
1089     */
1090    requestInStream(url: string, options?: HttpRequestOptions): Promise<number>;
1091
1092    /**
1093     * Destroys an HTTP request.
1094     * @syscap SystemCapability.Communication.NetStack
1095     * @since 6
1096     */
1097    /**
1098     * Destroys an HTTP request.
1099     * @syscap SystemCapability.Communication.NetStack
1100     * @crossplatform
1101     * @since 10
1102     */
1103    /**
1104     * Destroys an HTTP request.
1105     * @syscap SystemCapability.Communication.NetStack
1106     * @crossplatform
1107     * @atomicservice
1108     * @since 11
1109     */
1110    destroy(): void;
1111
1112    /**
1113     * Registers an observer for HTTP Response Header events.
1114     * @param { "headerReceive" } type - Indicates Event name.
1115     * @param { AsyncCallback<Object> } callback - the callback used to return the result.
1116     * @syscap SystemCapability.Communication.NetStack
1117     * @since 6
1118     * @deprecated since 8
1119     * @useinstead on_headersReceive
1120     */
1121    on(type: "headerReceive", callback: AsyncCallback<Object>): void;
1122
1123    /**
1124     * Unregisters the observer for HTTP Response Header events.
1125     * @param { "headerReceive" } type - Indicates Event name.
1126     * @param { AsyncCallback<Object> } callback - the callback used to return the result.
1127     * @syscap SystemCapability.Communication.NetStack
1128     * @since 6
1129     * @deprecated since 8
1130     * @useinstead off_headersReceive
1131     */
1132    off(type: "headerReceive", callback?: AsyncCallback<Object>): void;
1133
1134    /**
1135     * Registers an observer for HTTP Response Header events.
1136     * @param { "headersReceive" } type - Indicates Event name.
1137     * @param { Callback<Object> } callback - the callback used to return the result.
1138     * @syscap SystemCapability.Communication.NetStack
1139     * @since 8
1140     */
1141    /**
1142     * Registers an observer for HTTP Response Header events.
1143     * @param { "headersReceive" } type - Indicates Event name.
1144     * @param { Callback<Object> } callback - the callback used to return the result.
1145     * @syscap SystemCapability.Communication.NetStack
1146     * @crossplatform
1147     * @since 10
1148     */
1149    /**
1150     * Registers an observer for HTTP Response Header events.
1151     * @param { "headersReceive" } type - Indicates Event name.
1152     * @param { Callback<Object> } callback - the callback used to return the result.
1153     * @syscap SystemCapability.Communication.NetStack
1154     * @crossplatform
1155     * @atomicservice
1156     * @since 11
1157     */
1158    on(type: 'headersReceive', callback: Callback<Object>): void;
1159
1160    /**
1161     * Unregisters the observer for HTTP Response Header events.
1162     * @param { "headersReceive" } type - Indicates Event name.
1163     * @param { Callback<Object> } callback - the callback used to return the result.
1164     * @syscap SystemCapability.Communication.NetStack
1165     * @since 8
1166     */
1167    /**
1168     * Unregisters the observer for HTTP Response Header events.
1169     * @param { "headersReceive" } type - Indicates Event name.
1170     * @param { Callback<Object> } callback - the callback used to return the result.
1171     * @syscap SystemCapability.Communication.NetStack
1172     * @crossplatform
1173     * @since 10
1174     */
1175    /**
1176     * Unregisters the observer for HTTP Response Header events.
1177     * @param { "headersReceive" } type - Indicates Event name.
1178     * @param { Callback<Object> } callback - the callback used to return the result.
1179     * @syscap SystemCapability.Communication.NetStack
1180     * @crossplatform
1181     * @atomicservice
1182     * @since 11
1183     */
1184    off(type: 'headersReceive', callback?: Callback<Object>): void;
1185
1186    /**
1187     * Registers a one-time observer for HTTP Response Header events.
1188     * @param { "headersReceive" } type - Indicates Event name.
1189     * @param { Callback<Object> } callback - the callback used to return the result.
1190     * @syscap SystemCapability.Communication.NetStack
1191     * @since 8
1192     */
1193    /**
1194     * Registers a one-time observer for HTTP Response Header events.
1195     * @param { "headersReceive" } type - Indicates Event name.
1196     * @param { Callback<Object> } callback - the callback used to return the result.
1197     * @syscap SystemCapability.Communication.NetStack
1198     * @crossplatform
1199     * @since 10
1200     */
1201    once(type: 'headersReceive', callback: Callback<Object>): void;
1202
1203    /**
1204     * Registers an observer for receiving HTTP Response data events continuously.
1205     * @param { "dataReceive" } type - Indicates Event name.
1206     * @param { Callback<ArrayBuffer> } callback - the callback used to return the result.
1207     * @syscap SystemCapability.Communication.NetStack
1208     * @since 10
1209     */
1210    on(type: 'dataReceive', callback: Callback<ArrayBuffer>): void;
1211
1212    /**
1213     * Unregisters an observer for receiving HTTP Response data events continuously.
1214     * @param { "dataReceive" } type - Indicates Event name.
1215     * @param { Callback<ArrayBuffer> } callback - the callback used to return the result.
1216     * @syscap SystemCapability.Communication.NetStack
1217     * @since 10
1218     */
1219    off(type: 'dataReceive', callback?: Callback<ArrayBuffer>): void;
1220
1221    /**
1222     * Registers an observer for receiving HTTP Response data ends events.
1223     * @param { "dataEnd" } type - Indicates Event name.
1224     * @param { Callback<void> } callback - the callback used to return the result.
1225     * @syscap SystemCapability.Communication.NetStack
1226     * @since 10
1227     */
1228    on(type: 'dataEnd', callback: Callback<void>): void;
1229
1230    /**
1231     * Unregisters an observer for receiving HTTP Response data ends events.
1232     * @param { "dataEnd" } type - Indicates Event name.
1233     * @param { Callback<void> } callback - the callback used to return the result.
1234     * @syscap SystemCapability.Communication.NetStack
1235     * @since 10
1236     */
1237    off(type: 'dataEnd', callback?: Callback<void>): void;
1238
1239    /**
1240     * Registers an observer for progress of receiving HTTP Response data events.
1241     * @param { 'dataReceiveProgress' } type - Indicates Event name.
1242     * @param { Callback<{ receiveSize: number, totalSize: number }> } callback - the callback used to return the result.
1243     * @syscap SystemCapability.Communication.NetStack
1244     * @since 10
1245     */
1246    on(type: 'dataReceiveProgress', callback: Callback<{ receiveSize: number, totalSize: number }>): void;
1247
1248    /**
1249     * Unregisters an observer for progress of receiving HTTP Response data events.
1250     * @param { 'dataReceiveProgress' } type - Indicates Event name.
1251     * @param { Callback<{ receiveSize: number, totalSize: number }> } callback - the callback used to return the result.
1252     * @syscap SystemCapability.Communication.NetStack
1253     * @since 10
1254     */
1255    off(type: 'dataReceiveProgress', callback?: Callback<{ receiveSize: number, totalSize: number }>): void;
1256
1257    /**
1258     * Registers an observer for progress of sendSize HTTP Response data events.
1259     * @param { 'dataSendProgress' } type - Indicates Event name.
1260     * @param { Callback<{ sendSize: number, totalSize: number }> } callback - the callback of on.
1261     * @syscap SystemCapability.Communication.NetStack
1262     * @since 11
1263     */
1264    on(type: 'dataSendProgress', callback: Callback<{ sendSize: number, totalSize: number }>): void
1265
1266    /**
1267     * Unregisters an observer for progress of sendSize HTTP Response data events.
1268     * @param { 'dataSendProgress' } type - Indicates Event name.
1269     * @param { Callback<{ sendSize: number, totalSize: number }> } callback - the callback of off.
1270     * @syscap SystemCapability.Communication.NetStack
1271     * @since 11
1272     */
1273    off(type: 'dataSendProgress', callback?: Callback<{ sendSize: number, totalSize: number }>): void
1274  }
1275
1276  /**
1277   * Defines an HTTP request method.
1278   * @enum {string}
1279   * @syscap SystemCapability.Communication.NetStack
1280   * @since 6
1281   */
1282  /**
1283   * Defines an HTTP request method.
1284   * @enum {string}
1285   * @syscap SystemCapability.Communication.NetStack
1286   * @crossplatform
1287   * @since 10
1288   */
1289  /**
1290   * Defines an HTTP request method.
1291   * @enum {string}
1292   * @syscap SystemCapability.Communication.NetStack
1293   * @crossplatform
1294   * @atomicservice
1295   * @since 11
1296   */
1297  export enum RequestMethod {
1298    /**
1299     * OPTIONS method.
1300     * @syscap SystemCapability.Communication.NetStack
1301     * @since 6
1302     */
1303    /**
1304     * OPTIONS method.
1305     * @syscap SystemCapability.Communication.NetStack
1306     * @crossplatform
1307     * @since 10
1308     */
1309    /**
1310     * OPTIONS method.
1311     * @syscap SystemCapability.Communication.NetStack
1312     * @crossplatform
1313     * @atomicservice
1314     * @since 11
1315     */
1316    OPTIONS = "OPTIONS",
1317
1318    /**
1319     * GET method.
1320     * @syscap SystemCapability.Communication.NetStack
1321     * @since 6
1322     */
1323    /**
1324     * GET method.
1325     * @syscap SystemCapability.Communication.NetStack
1326     * @crossplatform
1327     * @since 10
1328     */
1329    /**
1330     * GET method.
1331     * @syscap SystemCapability.Communication.NetStack
1332     * @crossplatform
1333     * @atomicservice
1334     * @since 11
1335     */
1336    GET = "GET",
1337
1338    /**
1339     * HEAD method.
1340     * @syscap SystemCapability.Communication.NetStack
1341     * @since 6
1342     */
1343    /**
1344     * HEAD method.
1345     * @syscap SystemCapability.Communication.NetStack
1346     * @crossplatform
1347     * @since 10
1348     */
1349    /**
1350     * HEAD method.
1351     * @syscap SystemCapability.Communication.NetStack
1352     * @crossplatform
1353     * @atomicservice
1354     * @since 11
1355     */
1356    HEAD = "HEAD",
1357
1358    /**
1359     * POST method.
1360     * @syscap SystemCapability.Communication.NetStack
1361     * @since 6
1362     */
1363    /**
1364     * POST method.
1365     * @syscap SystemCapability.Communication.NetStack
1366     * @crossplatform
1367     * @since 10
1368     */
1369    /**
1370     * POST method.
1371     * @syscap SystemCapability.Communication.NetStack
1372     * @crossplatform
1373     * @atomicservice
1374     * @since 11
1375     */
1376    POST = "POST",
1377
1378    /**
1379     * PUT method.
1380     * @syscap SystemCapability.Communication.NetStack
1381     * @since 6
1382     */
1383    /**
1384     * PUT method.
1385     * @syscap SystemCapability.Communication.NetStack
1386     * @crossplatform
1387     * @since 10
1388     */
1389    /**
1390     * PUT method.
1391     * @syscap SystemCapability.Communication.NetStack
1392     * @crossplatform
1393     * @atomicservice
1394     * @since 11
1395     */
1396    PUT = "PUT",
1397
1398    /**
1399     * DELETE method.
1400     * @syscap SystemCapability.Communication.NetStack
1401     * @since 6
1402     */
1403    /**
1404     * DELETE method.
1405     * @syscap SystemCapability.Communication.NetStack
1406     * @crossplatform
1407     * @since 10
1408     */
1409    /**
1410     * DELETE method.
1411     * @syscap SystemCapability.Communication.NetStack
1412     * @crossplatform
1413     * @atomicservice
1414     * @since 11
1415     */
1416    DELETE = "DELETE",
1417
1418    /**
1419     * TRACE method.
1420     * @syscap SystemCapability.Communication.NetStack
1421     * @since 6
1422     */
1423    /**
1424     * TRACE method.
1425     * @syscap SystemCapability.Communication.NetStack
1426     * @crossplatform
1427     * @since 10
1428     */
1429    /**
1430     * TRACE method.
1431     * @syscap SystemCapability.Communication.NetStack
1432     * @crossplatform
1433     * @atomicservice
1434     * @since 11
1435     */
1436    TRACE = "TRACE",
1437
1438    /**
1439     * CONNECT method.
1440     * @syscap SystemCapability.Communication.NetStack
1441     * @since 6
1442     */
1443    /**
1444     * CONNECT method.
1445     * @syscap SystemCapability.Communication.NetStack
1446     * @crossplatform
1447     * @since 10
1448     */
1449    /**
1450     * CONNECT method.
1451     * @syscap SystemCapability.Communication.NetStack
1452     * @crossplatform
1453     * @atomicservice
1454     * @since 11
1455     */
1456    CONNECT = "CONNECT"
1457  }
1458
1459  /**
1460   * Enumerates the response codes for an HTTP request.
1461   * @enum {number}
1462   * @syscap SystemCapability.Communication.NetStack
1463   * @since 6
1464   */
1465  /**
1466   * Enumerates the response codes for an HTTP request.
1467   * @enum {number}
1468   * @syscap SystemCapability.Communication.NetStack
1469   * @crossplatform
1470   * @since 10
1471   */
1472  /**
1473   * Enumerates the response codes for an HTTP request.
1474   * @enum {number}
1475   * @syscap SystemCapability.Communication.NetStack
1476   * @crossplatform
1477   * @atomicservice
1478   * @since 11
1479   */
1480  export enum ResponseCode {
1481    /**
1482     * The request was successful. Typically used for GET and POST requests.
1483     * @syscap SystemCapability.Communication.NetStack
1484     * @since 6
1485     */
1486    /**
1487     * The request was successful. Typically used for GET and POST requests.
1488     * @syscap SystemCapability.Communication.NetStack
1489     * @crossplatform
1490     * @since 10
1491     */
1492    /**
1493     * The request was successful. Typically used for GET and POST requests.
1494     * @syscap SystemCapability.Communication.NetStack
1495     * @crossplatform
1496     * @atomicservice
1497     * @since 11
1498     */
1499    OK = 200,
1500
1501    /**
1502     * Successfully requested and created a new resource.
1503     * @syscap SystemCapability.Communication.NetStack
1504     * @since 6
1505     */
1506    /**
1507     * Successfully requested and created a new resource.
1508     * @syscap SystemCapability.Communication.NetStack
1509     * @crossplatform
1510     * @since 10
1511     */
1512    /**
1513     * Successfully requested and created a new resource.
1514     * @syscap SystemCapability.Communication.NetStack
1515     * @crossplatform
1516     * @atomicservice
1517     * @since 11
1518     */
1519    CREATED,
1520
1521    /**
1522     * The request has been accepted but has not been processed completely.
1523     * @syscap SystemCapability.Communication.NetStack
1524     * @since 6
1525     */
1526    /**
1527     * The request has been accepted but has not been processed completely.
1528     * @syscap SystemCapability.Communication.NetStack
1529     * @crossplatform
1530     * @since 10
1531     */
1532    /**
1533     * The request has been accepted but has not been processed completely.
1534     * @syscap SystemCapability.Communication.NetStack
1535     * @crossplatform
1536     * @atomicservice
1537     * @since 11
1538     */
1539    ACCEPTED,
1540
1541    /**
1542     * Unauthorized information. The request was successful.
1543     * @syscap SystemCapability.Communication.NetStack
1544     * @since 6
1545     */
1546    /**
1547     * Unauthorized information. The request was successful.
1548     * @syscap SystemCapability.Communication.NetStack
1549     * @crossplatform
1550     * @since 10
1551     */
1552    /**
1553     * Unauthorized information. The request was successful.
1554     * @syscap SystemCapability.Communication.NetStack
1555     * @crossplatform
1556     * @atomicservice
1557     * @since 11
1558     */
1559    NOT_AUTHORITATIVE,
1560
1561    /**
1562     * No content. The server successfully processed, but did not return content.
1563     * @syscap SystemCapability.Communication.NetStack
1564     * @since 6
1565     */
1566    /**
1567     * No content. The server successfully processed, but did not return content.
1568     * @syscap SystemCapability.Communication.NetStack
1569     * @crossplatform
1570     * @since 10
1571     */
1572    /**
1573     * No content. The server successfully processed, but did not return content.
1574     * @syscap SystemCapability.Communication.NetStack
1575     * @crossplatform
1576     * @atomicservice
1577     * @since 11
1578     */
1579    NO_CONTENT,
1580
1581    /**
1582     * Reset the content.
1583     * @syscap SystemCapability.Communication.NetStack
1584     * @since 6
1585     */
1586    /**
1587     * Reset the content.
1588     * @syscap SystemCapability.Communication.NetStack
1589     * @crossplatform
1590     * @since 10
1591     */
1592    /**
1593     * Reset the content.
1594     * @syscap SystemCapability.Communication.NetStack
1595     * @crossplatform
1596     * @atomicservice
1597     * @since 11
1598     */
1599    RESET,
1600
1601    /**
1602     * Partial content. The server successfully processed some GET requests.
1603     * @syscap SystemCapability.Communication.NetStack
1604     * @since 6
1605     */
1606    /**
1607     * Partial content. The server successfully processed some GET requests.
1608     * @syscap SystemCapability.Communication.NetStack
1609     * @crossplatform
1610     * @since 10
1611     */
1612    /**
1613     * Partial content. The server successfully processed some GET requests.
1614     * @syscap SystemCapability.Communication.NetStack
1615     * @crossplatform
1616     * @atomicservice
1617     * @since 11
1618     */
1619    PARTIAL,
1620
1621    /**
1622     * Multiple options.
1623     * @syscap SystemCapability.Communication.NetStack
1624     * @since 6
1625     */
1626    /**
1627     * Multiple options.
1628     * @syscap SystemCapability.Communication.NetStack
1629     * @crossplatform
1630     * @since 10
1631     */
1632    /**
1633     * Multiple options.
1634     * @syscap SystemCapability.Communication.NetStack
1635     * @crossplatform
1636     * @atomicservice
1637     * @since 11
1638     */
1639    MULT_CHOICE = 300,
1640
1641    /**
1642     * <p>Permanently move. The requested resource has been permanently moved to a new URI,
1643     * and the returned information will include the new URI. The browser will automatically redirect to the new URI.</p>
1644     * @syscap SystemCapability.Communication.NetStack
1645     * @since 6
1646     */
1647    /**
1648     * <p>Permanently move. The requested resource has been permanently moved to a new URI,
1649     * and the returned information will include the new URI. The browser will automatically redirect to the new URI.</p>
1650     * @syscap SystemCapability.Communication.NetStack
1651     * @crossplatform
1652     * @since 10
1653     */
1654    /**
1655     * <p>Permanently move. The requested resource has been permanently moved to a new URI,
1656     * and the returned information will include the new URI. The browser will automatically redirect to the new URI.</p>
1657     * @syscap SystemCapability.Communication.NetStack
1658     * @crossplatform
1659     * @atomicservice
1660     * @since 11
1661     */
1662    MOVED_PERM,
1663
1664    /**
1665     * Temporary movement.
1666     * @syscap SystemCapability.Communication.NetStack
1667     * @since 6
1668     */
1669    /**
1670     * Temporary movement.
1671     * @syscap SystemCapability.Communication.NetStack
1672     * @crossplatform
1673     * @since 10
1674     */
1675    /**
1676     * Temporary movement.
1677     * @syscap SystemCapability.Communication.NetStack
1678     * @crossplatform
1679     * @atomicservice
1680     * @since 11
1681     */
1682    MOVED_TEMP,
1683
1684    /**
1685     * View other addresses.
1686     * @syscap SystemCapability.Communication.NetStack
1687     * @since 6
1688     */
1689    /**
1690     * View other addresses.
1691     * @syscap SystemCapability.Communication.NetStack
1692     * @crossplatform
1693     * @since 10
1694     */
1695    /**
1696     * View other addresses.
1697     * @syscap SystemCapability.Communication.NetStack
1698     * @crossplatform
1699     * @atomicservice
1700     * @since 11
1701     */
1702    SEE_OTHER,
1703
1704    /**
1705     * Not modified.
1706     * @syscap SystemCapability.Communication.NetStack
1707     * @since 6
1708     */
1709    /**
1710     * Not modified.
1711     * @syscap SystemCapability.Communication.NetStack
1712     * @crossplatform
1713     * @since 10
1714     */
1715    /**
1716     * Not modified.
1717     * @syscap SystemCapability.Communication.NetStack
1718     * @crossplatform
1719     * @atomicservice
1720     * @since 11
1721     */
1722    NOT_MODIFIED,
1723
1724    /**
1725     * Using proxies.
1726     * @syscap SystemCapability.Communication.NetStack
1727     * @since 6
1728     */
1729    /**
1730     * Using proxies.
1731     * @syscap SystemCapability.Communication.NetStack
1732     * @crossplatform
1733     * @since 10
1734     */
1735    /**
1736     * Using proxies.
1737     * @syscap SystemCapability.Communication.NetStack
1738     * @crossplatform
1739     * @since 10
1740     */
1741    USE_PROXY,
1742
1743    /**
1744     * The server cannot understand the syntax error error requested by the client.
1745     * @syscap SystemCapability.Communication.NetStack
1746     * @since 6
1747     */
1748    /**
1749     * The server cannot understand the syntax error error requested by the client.
1750     * @syscap SystemCapability.Communication.NetStack
1751     * @crossplatform
1752     * @since 10
1753     */
1754    /**
1755     * The server cannot understand the syntax error error requested by the client.
1756     * @syscap SystemCapability.Communication.NetStack
1757     * @crossplatform
1758     * @atomicservice
1759     * @since 11
1760     */
1761    BAD_REQUEST = 400,
1762
1763    /**
1764     * Request for user authentication.
1765     * @syscap SystemCapability.Communication.NetStack
1766     * @since 6
1767     */
1768    /**
1769     * Request for user authentication.
1770     * @syscap SystemCapability.Communication.NetStack
1771     * @crossplatform
1772     * @since 10
1773     */
1774    /**
1775     * Request for user authentication.
1776     * @syscap SystemCapability.Communication.NetStack
1777     * @crossplatform
1778     * @atomicservice
1779     * @since 11
1780     */
1781    UNAUTHORIZED,
1782
1783    /**
1784     * Reserved for future use.
1785     * @syscap SystemCapability.Communication.NetStack
1786     * @since 6
1787     */
1788    /**
1789     * Reserved for future use.
1790     * @syscap SystemCapability.Communication.NetStack
1791     * @crossplatform
1792     * @since 10
1793     */
1794    /**
1795     * Reserved for future use.
1796     * @syscap SystemCapability.Communication.NetStack
1797     * @crossplatform
1798     * @atomicservice
1799     * @since 11
1800     */
1801    PAYMENT_REQUIRED,
1802
1803    /**
1804     * The server understands the request from the requesting client, but refuses to execute it.
1805     * @syscap SystemCapability.Communication.NetStack
1806     * @since 6
1807     */
1808    /**
1809     * The server understands the request from the requesting client, but refuses to execute it.
1810     * @syscap SystemCapability.Communication.NetStack
1811     * @crossplatform
1812     * @since 10
1813     */
1814    /**
1815     * The server understands the request from the requesting client, but refuses to execute it.
1816     * @syscap SystemCapability.Communication.NetStack
1817     * @crossplatform
1818     * @atomicservice
1819     * @since 11
1820     */
1821    FORBIDDEN,
1822
1823    /**
1824     * The server was unable to find resources (web pages) based on the client's request.
1825     * @syscap SystemCapability.Communication.NetStack
1826     * @since 6
1827     */
1828    /**
1829     * The server was unable to find resources (web pages) based on the client's request.
1830     * @syscap SystemCapability.Communication.NetStack
1831     * @crossplatform
1832     * @since 10
1833     */
1834    /**
1835     * The server was unable to find resources (web pages) based on the client's request.
1836     * @syscap SystemCapability.Communication.NetStack
1837     * @crossplatform
1838     * @atomicservice
1839     * @since 11
1840     */
1841    NOT_FOUND,
1842
1843    /**
1844     * The method in the client request is prohibited.
1845     * @syscap SystemCapability.Communication.NetStack
1846     * @since 6
1847     */
1848    /**
1849     * The method in the client request is prohibited.
1850     * @syscap SystemCapability.Communication.NetStack
1851     * @crossplatform
1852     * @since 10
1853     */
1854    /**
1855     * The method in the client request is prohibited.
1856     * @syscap SystemCapability.Communication.NetStack
1857     * @crossplatform
1858     * @atomicservice
1859     * @since 11
1860     */
1861    BAD_METHOD,
1862
1863    /**
1864     * The server is unable to complete the request based on the content characteristics requested by the client.
1865     * @syscap SystemCapability.Communication.NetStack
1866     * @since 6
1867     */
1868    /**
1869     * The server is unable to complete the request based on the content characteristics requested by the client.
1870     * @syscap SystemCapability.Communication.NetStack
1871     * @crossplatform
1872     * @since 10
1873     */
1874    /**
1875     * The server is unable to complete the request based on the content characteristics requested by the client.
1876     * @syscap SystemCapability.Communication.NetStack
1877     * @crossplatform
1878     * @atomicservice
1879     * @since 11
1880     */
1881    NOT_ACCEPTABLE,
1882
1883    /**
1884     * Request authentication of the proxy's identity.
1885     * @syscap SystemCapability.Communication.NetStack
1886     * @since 6
1887     */
1888    /**
1889     * Request authentication of the proxy's identity.
1890     * @syscap SystemCapability.Communication.NetStack
1891     * @crossplatform
1892     * @since 10
1893     */
1894    /**
1895     * Request authentication of the proxy's identity.
1896     * @syscap SystemCapability.Communication.NetStack
1897     * @crossplatform
1898     * @atomicservice
1899     * @since 11
1900     */
1901    PROXY_AUTH,
1902
1903    /**
1904     * The request took too long and timed out.
1905     * @syscap SystemCapability.Communication.NetStack
1906     * @since 6
1907     */
1908    /**
1909     * The request took too long and timed out.
1910     * @syscap SystemCapability.Communication.NetStack
1911     * @crossplatform
1912     * @since 10
1913     */
1914    /**
1915     * The request took too long and timed out.
1916     * @syscap SystemCapability.Communication.NetStack
1917     * @crossplatform
1918     * @atomicservice
1919     * @since 11
1920     */
1921    CLIENT_TIMEOUT,
1922
1923    /**
1924     * <p>The server may have returned this code when completing the client's PUT request,
1925     * as there was a conflict when the server was processing the request.</p>
1926     * @syscap SystemCapability.Communication.NetStack
1927     * @since 6
1928     */
1929    /**
1930     * <p>The server may have returned this code when completing the client's PUT request,
1931     * as there was a conflict when the server was processing the request.</p>
1932     * @syscap SystemCapability.Communication.NetStack
1933     * @crossplatform
1934     * @since 10
1935     */
1936    /**
1937     * <p>The server may have returned this code when completing the client's PUT request,
1938     * as there was a conflict when the server was processing the request.</p>
1939     * @syscap SystemCapability.Communication.NetStack
1940     * @crossplatform
1941     * @atomicservice
1942     * @since 11
1943     */
1944    CONFLICT,
1945
1946    /**
1947     * The resource requested by the client no longer exists.
1948     * @syscap SystemCapability.Communication.NetStack
1949     * @since 6
1950     */
1951    /**
1952     * The resource requested by the client no longer exists.
1953     * @syscap SystemCapability.Communication.NetStack
1954     * @crossplatform
1955     * @since 10
1956     */
1957    /**
1958     * The resource requested by the client no longer exists.
1959     * @syscap SystemCapability.Communication.NetStack
1960     * @crossplatform
1961     * @atomicservice
1962     * @since 11
1963     */
1964    GONE,
1965
1966    /**
1967     * The server is unable to process request information sent by the client without Content Length.
1968     * @syscap SystemCapability.Communication.NetStack
1969     * @since 6
1970     */
1971    /**
1972     * The server is unable to process request information sent by the client without Content Length.
1973     * @syscap SystemCapability.Communication.NetStack
1974     * @crossplatform
1975     * @since 10
1976     */
1977    /**
1978     * The server is unable to process request information sent by the client without Content Length.
1979     * @syscap SystemCapability.Communication.NetStack
1980     * @crossplatform
1981     * @atomicservice
1982     * @since 11
1983     */
1984    LENGTH_REQUIRED,
1985
1986    /**
1987     * The prerequisite for requesting information from the client is incorrect.
1988     * @syscap SystemCapability.Communication.NetStack
1989     * @since 6
1990     */
1991    /**
1992     * The prerequisite for requesting information from the client is incorrect.
1993     * @syscap SystemCapability.Communication.NetStack
1994     * @crossplatform
1995     * @since 10
1996     */
1997    /**
1998     * The prerequisite for requesting information from the client is incorrect.
1999     * @syscap SystemCapability.Communication.NetStack
2000     * @crossplatform
2001     * @atomicservice
2002     * @since 11
2003     */
2004    PRECON_FAILED,
2005
2006    /**
2007     * The request was rejected because the requested entity was too large for the server to process.
2008     * @syscap SystemCapability.Communication.NetStack
2009     * @since 6
2010     */
2011    /**
2012     * The request was rejected because the requested entity was too large for the server to process.
2013     * @syscap SystemCapability.Communication.NetStack
2014     * @crossplatform
2015     * @since 10
2016     */
2017    /**
2018     * The request was rejected because the requested entity was too large for the server to process.
2019     * @syscap SystemCapability.Communication.NetStack
2020     * @crossplatform
2021     * @atomicservice
2022     * @since 11
2023     */
2024    ENTITY_TOO_LARGE,
2025
2026    /**
2027     * The requested URI is too long (usually a URL) and the server cannot process it.
2028     * @syscap SystemCapability.Communication.NetStack
2029     * @since 6
2030     */
2031    /**
2032     * The requested URI is too long (usually a URL) and the server cannot process it.
2033     * @syscap SystemCapability.Communication.NetStack
2034     * @crossplatform
2035     * @since 10
2036     */
2037    /**
2038     * The requested URI is too long (usually a URL) and the server cannot process it.
2039     * @syscap SystemCapability.Communication.NetStack
2040     * @crossplatform
2041     * @atomicservice
2042     * @since 11
2043     */
2044    REQ_TOO_LONG,
2045
2046    /**
2047     * The server is unable to process the requested format.
2048     * @syscap SystemCapability.Communication.NetStack
2049     * @since 6
2050     */
2051    /**
2052     * The server is unable to process the requested format.
2053     * @syscap SystemCapability.Communication.NetStack
2054     * @crossplatform
2055     * @since 10
2056     */
2057    /**
2058     * The server is unable to process the requested format.
2059     * @syscap SystemCapability.Communication.NetStack
2060     * @crossplatform
2061     * @atomicservice
2062     * @since 11
2063     */
2064    UNSUPPORTED_TYPE,
2065
2066    /**
2067     * Internal server error, unable to complete the request.
2068     * @syscap SystemCapability.Communication.NetStack
2069     * @since 6
2070     */
2071    /**
2072     * Internal server error, unable to complete the request.
2073     * @syscap SystemCapability.Communication.NetStack
2074     * @crossplatform
2075     * @since 10
2076     */
2077    /**
2078     * Internal server error, unable to complete the request.
2079     * @syscap SystemCapability.Communication.NetStack
2080     * @crossplatform
2081     * @atomicservice
2082     * @since 11
2083     */
2084    INTERNAL_ERROR = 500,
2085
2086    /**
2087     * The server does not support the requested functionality and cannot complete the request.
2088     * @syscap SystemCapability.Communication.NetStack
2089     * @since 6
2090     */
2091    /**
2092     * The server does not support the requested functionality and cannot complete the request.
2093     * @syscap SystemCapability.Communication.NetStack
2094     * @crossplatform
2095     * @since 10
2096     */
2097    /**
2098     * The server does not support the requested functionality and cannot complete the request.
2099     * @syscap SystemCapability.Communication.NetStack
2100     * @crossplatform
2101     * @atomicservice
2102     * @since 11
2103     */
2104    NOT_IMPLEMENTED,
2105
2106    /**
2107     * The server acting as a gateway or proxy received an invalid request from the remote server.
2108     * @syscap SystemCapability.Communication.NetStack
2109     * @since 6
2110     */
2111    /**
2112     * The server acting as a gateway or proxy received an invalid request from the remote server.
2113     * @syscap SystemCapability.Communication.NetStack
2114     * @crossplatform
2115     * @since 10
2116     */
2117    /**
2118     * The server acting as a gateway or proxy received an invalid request from the remote server.
2119     * @syscap SystemCapability.Communication.NetStack
2120     * @crossplatform
2121     * @atomicservice
2122     * @since 11
2123     */
2124    BAD_GATEWAY,
2125
2126    /**
2127     * Due to overload or system maintenance, the server is temporarily unable to process client requests.
2128     * @syscap SystemCapability.Communication.NetStack
2129     * @since 6
2130     */
2131    /**
2132     * Due to overload or system maintenance, the server is temporarily unable to process client requests.
2133     * @syscap SystemCapability.Communication.NetStack
2134     * @crossplatform
2135     * @since 10
2136     */
2137    /**
2138     * Due to overload or system maintenance, the server is temporarily unable to process client requests.
2139     * @syscap SystemCapability.Communication.NetStack
2140     * @crossplatform
2141     * @atomicservice
2142     * @since 11
2143     */
2144    UNAVAILABLE,
2145
2146    /**
2147     * The server acting as a gateway or proxy did not obtain requests from the remote server in a timely manner.
2148     * @syscap SystemCapability.Communication.NetStack
2149     * @since 6
2150     */
2151    /**
2152     * The server acting as a gateway or proxy did not obtain requests from the remote server in a timely manner.
2153     * @syscap SystemCapability.Communication.NetStack
2154     * @crossplatform
2155     * @since 10
2156     */
2157    /**
2158     * The server acting as a gateway or proxy did not obtain requests from the remote server in a timely manner.
2159     * @syscap SystemCapability.Communication.NetStack
2160     * @crossplatform
2161     * @atomicservice
2162     * @since 11
2163     */
2164    GATEWAY_TIMEOUT,
2165
2166    /**
2167     * The version of the HTTP protocol requested by the server.
2168     * @syscap SystemCapability.Communication.NetStack
2169     * @since 6
2170     */
2171    /**
2172     * The version of the HTTP protocol requested by the server.
2173     * @syscap SystemCapability.Communication.NetStack
2174     * @crossplatform
2175     * @since 10
2176     */
2177    /**
2178     * The version of the HTTP protocol requested by the server.
2179     * @syscap SystemCapability.Communication.NetStack
2180     * @crossplatform
2181     * @atomicservice
2182     * @since 11
2183     */
2184    VERSION
2185  }
2186
2187  /**
2188   * Supported protocols.
2189   * @enum {string}
2190   * @syscap SystemCapability.Communication.NetStack
2191   * @since 9
2192   */
2193  /**
2194   * Supported protocols.
2195   * @enum {string}
2196   * @syscap SystemCapability.Communication.NetStack
2197   * @crossplatform
2198   * @since 10
2199   */
2200  /**
2201   * Supported protocols.
2202   * @enum {string}
2203   * @syscap SystemCapability.Communication.NetStack
2204   * @crossplatform
2205   * @atomicservice
2206   * @since 11
2207   */
2208
2209  export enum HttpProtocol {
2210    /**
2211     * Protocol http1.1
2212     * @syscap SystemCapability.Communication.NetStack
2213     * @since 9
2214     */
2215    /**
2216     * Protocol http1.1
2217     * @syscap SystemCapability.Communication.NetStack
2218     * @crossplatform
2219     * @since 10
2220     */
2221    /**
2222     * Protocol http1.1
2223     * @syscap SystemCapability.Communication.NetStack
2224     * @crossplatform
2225     * @atomicservice
2226     * @since 11
2227     */
2228    HTTP1_1,
2229
2230    /**
2231     * Protocol http2
2232     * @syscap SystemCapability.Communication.NetStack
2233     * @since 9
2234     */
2235    /**
2236     * Protocol http2
2237     * @syscap SystemCapability.Communication.NetStack
2238     * @crossplatform
2239     * @since 10
2240     */
2241    /**
2242     * Protocol http2
2243     * @syscap SystemCapability.Communication.NetStack
2244     * @crossplatform
2245     * @atomicservice
2246     * @since 11
2247     */
2248    HTTP2,
2249
2250    /**
2251     * Protocol http3 for https only.
2252     * Cause error if using http only or not supporting http3 on this device.
2253     * Fallback to http2 or http1.1 if needed.
2254     * @syscap SystemCapability.Communication.NetStack
2255     * @since 11
2256     */
2257    HTTP3
2258  }
2259
2260  /**
2261   * Indicates the type of the returned data.
2262   * @enum {number}
2263   * @syscap SystemCapability.Communication.NetStack
2264   * @since 9
2265   */
2266  /**
2267   * Indicates the type of the returned data.
2268   * @enum {number}
2269   * @syscap SystemCapability.Communication.NetStack
2270   * @crossplatform
2271   * @since 10
2272   */
2273  /**
2274   * Indicates the type of the returned data.
2275   * @enum {number}
2276   * @syscap SystemCapability.Communication.NetStack
2277   * @crossplatform
2278   * @atomicservice
2279   * @since 11
2280   */
2281  export enum HttpDataType {
2282    /**
2283     * The returned type is string.
2284     * @syscap SystemCapability.Communication.NetStack
2285     * @since 9
2286     */
2287    /**
2288     * The returned type is string.
2289     * @syscap SystemCapability.Communication.NetStack
2290     * @crossplatform
2291     * @since 10
2292     */
2293    /**
2294     * The returned type is string.
2295     * @syscap SystemCapability.Communication.NetStack
2296     * @crossplatform
2297     * @atomicservice
2298     * @since 11
2299     */
2300    STRING,
2301
2302    /**
2303     * The returned type is Object.
2304     * @syscap SystemCapability.Communication.NetStack
2305     * @since 9
2306     */
2307    /**
2308     * The returned type is Object.
2309     * @syscap SystemCapability.Communication.NetStack
2310     * @crossplatform
2311     * @since 10
2312     */
2313    /**
2314     * The returned type is Object.
2315     * @syscap SystemCapability.Communication.NetStack
2316     * @crossplatform
2317     * @atomicservice
2318     * @since 11
2319     */
2320    OBJECT = 1,
2321
2322    /**
2323     * The returned type is ArrayBuffer.
2324     * @syscap SystemCapability.Communication.NetStack
2325     * @since 9
2326     */
2327    /**
2328     * The returned type is ArrayBuffer.
2329     * @syscap SystemCapability.Communication.NetStack
2330     * @crossplatform
2331     * @since 10
2332     */
2333    /**
2334     * The returned type is ArrayBuffer.
2335     * @syscap SystemCapability.Communication.NetStack
2336     * @crossplatform
2337     * @atomicservice
2338     * @since 11
2339     */
2340    ARRAY_BUFFER = 2
2341  }
2342
2343  /**
2344   * Defines the response to an HTTP request.
2345   * @interface HttpResponse
2346   * @syscap SystemCapability.Communication.NetStack
2347   * @since 6
2348   */
2349  /**
2350   * Defines the response to an HTTP request.
2351   * @interface HttpResponse
2352   * @syscap SystemCapability.Communication.NetStack
2353   * @crossplatform
2354   * @since 10
2355   */
2356  /**
2357   * Defines the response to an HTTP request.
2358   * @interface HttpResponse
2359   * @syscap SystemCapability.Communication.NetStack
2360   * @crossplatform
2361   * @atomicservice
2362   * @since 11
2363   */
2364  export interface HttpResponse {
2365    /**
2366     * result can be a string (API 6) or an ArrayBuffer(API 8). Object is deprecated from API 8.
2367     * If {@link HttpRequestOptions#expectDataType} is set, the system preferentially returns this parameter.
2368     * @type {string | Object | ArrayBuffer}
2369     * @syscap SystemCapability.Communication.NetStack
2370     * @since 6
2371     */
2372    /**
2373     * result can be a string (API 6) or an ArrayBuffer(API 8). Object is deprecated from API 8.
2374     * If {@link HttpRequestOptions#expectDataType} is set, the system preferentially returns this parameter.
2375     * @type {string | Object | ArrayBuffer}
2376     * @syscap SystemCapability.Communication.NetStack
2377     * @crossplatform
2378     * @since 10
2379     */
2380    /**
2381     * result can be a string (API 6) or an ArrayBuffer(API 8). Object is deprecated from API 8.
2382     * If {@link HttpRequestOptions#expectDataType} is set, the system preferentially returns this parameter.
2383     * @type {string | Object | ArrayBuffer}
2384     * @syscap SystemCapability.Communication.NetStack
2385     * @crossplatform
2386     * @atomicservice
2387     * @since 11
2388     */
2389    result: string | Object | ArrayBuffer;
2390
2391    /**
2392     * If the resultType is string, you can get result directly.
2393     * If the resultType is Object, you can get result such as this: result['key'].
2394     * If the resultType is ArrayBuffer, you can use ArrayBuffer to create the binary objects.
2395     * @type {HttpDataType}
2396     * @syscap SystemCapability.Communication.NetStack
2397     * @since 9
2398     */
2399    /**
2400     * If the resultType is string, you can get result directly.
2401     * If the resultType is Object, you can get result such as this: result['key'].
2402     * If the resultType is ArrayBuffer, you can use ArrayBuffer to create the binary objects.
2403     * @type {HttpDataType}
2404     * @syscap SystemCapability.Communication.NetStack
2405     * @crossplatform
2406     * @since 10
2407     */
2408    /**
2409     * If the resultType is string, you can get result directly.
2410     * If the resultType is Object, you can get result such as this: result['key'].
2411     * If the resultType is ArrayBuffer, you can use ArrayBuffer to create the binary objects.
2412     * @type {HttpDataType}
2413     * @syscap SystemCapability.Communication.NetStack
2414     * @crossplatform
2415     * @atomicservice
2416     * @since 11
2417     */
2418    resultType: HttpDataType;
2419
2420    /**
2421     * Server status code.
2422     * @type {ResponseCode | number}
2423     * @syscap SystemCapability.Communication.NetStack
2424     * @since 6
2425     */
2426    /**
2427     * Server status code.
2428     * @type {ResponseCode | number}
2429     * @syscap SystemCapability.Communication.NetStack
2430     * @crossplatform
2431     * @since 10
2432     */
2433    /**
2434     * Server status code.
2435     * @type {ResponseCode | number}
2436     * @syscap SystemCapability.Communication.NetStack
2437     * @crossplatform
2438     * @atomicservice
2439     * @since 11
2440     */
2441    responseCode: ResponseCode | number;
2442
2443    /**
2444     * All headers in the response from the server.
2445     * @type {Object}
2446     * @syscap SystemCapability.Communication.NetStack
2447     * @since 6
2448     */
2449    /**
2450     * All headers in the response from the server.
2451     * @type {Object}
2452     * @syscap SystemCapability.Communication.NetStack
2453     * @crossplatform
2454     * @since 10
2455     */
2456    /**
2457     * All headers in the response from the server.
2458     * @type {Object}
2459     * @syscap SystemCapability.Communication.NetStack
2460     * @crossplatform
2461     * @atomicservice
2462     * @since 11
2463     */
2464    header: Object;
2465
2466    /**
2467     * Cookies returned by the server.
2468     * @type {string}
2469     * @syscap SystemCapability.Communication.NetStack
2470     * @since 8
2471     */
2472    /**
2473     * Cookies returned by the server.
2474     * @type {string}
2475     * @syscap SystemCapability.Communication.NetStack
2476     * @crossplatform
2477     * @since 10
2478     */
2479    /**
2480     * Cookies returned by the server.
2481     * @type {string}
2482     * @syscap SystemCapability.Communication.NetStack
2483     * @crossplatform
2484     * @atomicservice
2485     * @since 11
2486     */
2487    cookies: string;
2488
2489    /**
2490     * The time taken of various stages of HTTP request.
2491     * @type {PerformanceTiming}
2492     * @syscap SystemCapability.Communication.NetStack
2493     * @since 11
2494     */
2495    performanceTiming: PerformanceTiming;
2496  }
2497
2498  /**
2499   * Counting the time taken of various stages of HTTP request.
2500   * @interface PerformanceTiming
2501   * @syscap SystemCapability.Communication.NetStack
2502   * @since 11
2503   */
2504  export interface PerformanceTiming {
2505    /**
2506     * Time taken from startup to DNS resolution completion, in milliseconds.
2507     * @type {number}
2508     * @syscap SystemCapability.Communication.NetStack
2509     * @since 11
2510     */
2511    dnsTiming: number;
2512
2513    /**
2514     * Time taken from startup to TCP connection completion, in milliseconds.
2515     * @type {number}
2516     * @syscap SystemCapability.Communication.NetStack
2517     * @since 11
2518     */
2519    tcpTiming: number;
2520
2521    /**
2522     * Time taken from startup to TLS connection completion, in milliseconds.
2523     * @type {number}
2524     * @syscap SystemCapability.Communication.NetStack
2525     * @since 11
2526     */
2527    tlsTiming: number;
2528
2529    /**
2530     * Time taken from startup to start sending the first byte, in milliseconds.
2531     * @type {number}
2532     * @syscap SystemCapability.Communication.NetStack
2533     * @since 11
2534     */
2535    firstSendTiming: number;
2536
2537    /**
2538     * Time taken from startup to receiving the first byte, in milliseconds.
2539     * @type {number}
2540     * @syscap SystemCapability.Communication.NetStack
2541     * @since 11
2542     */
2543    firstReceiveTiming: number;
2544
2545    /**
2546     * Time taken from startup to the completion of the request, in milliseconds.
2547     * @type {number}
2548     * @syscap SystemCapability.Communication.NetStack
2549     * @since 11
2550     */
2551    totalFinishTiming: number;
2552
2553    /**
2554     * Time taken from startup to completion of all redirection steps, in milliseconds.
2555     * @type {number}
2556     * @syscap SystemCapability.Communication.NetStack
2557     * @since 11
2558     */
2559    redirectTiming: number;
2560
2561    /**
2562     * Time taken from HTTP request to header completion, in milliseconds.
2563     * @type {number}
2564     * @syscap SystemCapability.Communication.NetStack
2565     * @since 11
2566     */
2567    responseHeaderTiming: number;
2568
2569    /**
2570     * Time taken from HTTP Request to body completion, in milliseconds.
2571     * @type {number}
2572     * @syscap SystemCapability.Communication.NetStack
2573     * @since 11
2574     */
2575    responseBodyTiming: number;
2576
2577    /**
2578     * Time taken from HTTP Request to callback to the application, in milliseconds.
2579     * @type {number}
2580     * @syscap SystemCapability.Communication.NetStack
2581     * @since 11
2582     */
2583    totalTiming: number;
2584  }
2585
2586  /**
2587   * Creates a default {@code HttpResponseCache} object to store the responses of HTTP access requests.
2588   * @param { number } cacheSize - the size of cache(max value is 10MB), default is 10*1024*1024(10MB).
2589   * @returns { HttpResponseCache } the HttpResponseCache of the createHttpResponseCache.
2590   * @syscap SystemCapability.Communication.NetStack
2591   * @since 9
2592   */
2593  /**
2594   * Creates a default {@code HttpResponseCache} object to store the responses of HTTP access requests.
2595   * @param { number } cacheSize - the size of cache(max value is 10MB), default is 10*1024*1024(10MB).
2596   * @returns { HttpResponseCache } the HttpResponseCache of the createHttpResponseCache.
2597   * @syscap SystemCapability.Communication.NetStack
2598   * @crossplatform
2599   * @since 10
2600   */
2601  /**
2602   * Creates a default {@code HttpResponseCache} object to store the responses of HTTP access requests.
2603   * @param { number } cacheSize - the size of cache(max value is 10MB), default is 10*1024*1024(10MB).
2604   * @returns { HttpResponseCache } the HttpResponseCache of the createHttpResponseCache.
2605   * @syscap SystemCapability.Communication.NetStack
2606   * @crossplatform
2607   * @atomicservice
2608   * @since 11
2609   */
2610  function createHttpResponseCache(cacheSize?: number): HttpResponseCache;
2611
2612  /**
2613   * Defines an object that stores the response to an HTTP request.
2614   * @interface HttpResponseCache
2615   * @syscap SystemCapability.Communication.NetStack
2616   * @since 9
2617   */
2618  /**
2619   * Defines an object that stores the response to an HTTP request.
2620   * @interface HttpResponseCache
2621   * @syscap SystemCapability.Communication.NetStack
2622   * @crossplatform
2623   * @since 10
2624   */
2625  /**
2626   * Defines an object that stores the response to an HTTP request.
2627   * @interface HttpResponseCache
2628   * @syscap SystemCapability.Communication.NetStack
2629   * @crossplatform
2630   * @atomicservice
2631   * @since 11
2632   */
2633  export interface HttpResponseCache {
2634    /**
2635     * Writes data in the cache to the file system so that all the cached data can be accessed in the next HTTP request.
2636     * @param { AsyncCallback<void> } callback - the callback of flush.
2637     * @syscap SystemCapability.Communication.NetStack
2638     * @since 9
2639     */
2640    /**
2641     * Writes data in the cache to the file system so that all the cached data can be accessed in the next HTTP request.
2642     * @param { AsyncCallback<void> } callback - the callback of flush.
2643     * @syscap SystemCapability.Communication.NetStack
2644     * @crossplatform
2645     * @since 10
2646     */
2647    /**
2648     * Writes data in the cache to the file system so that all the cached data can be accessed in the next HTTP request.
2649     * @param { AsyncCallback<void> } callback - the callback of flush.
2650     * @syscap SystemCapability.Communication.NetStack
2651     * @crossplatform
2652     * @atomicservice
2653     * @since 11
2654     */
2655    flush(callback: AsyncCallback<void>): void;
2656
2657    /**
2658     * Writes data in the cache to the file system so that all the cached data can be accessed in the next HTTP request.
2659     * @returns { Promise<void> } The promise returned by the flush.
2660     * @syscap SystemCapability.Communication.NetStack
2661     * @since 9
2662     */
2663    /**
2664     * Writes data in the cache to the file system so that all the cached data can be accessed in the next HTTP request.
2665     * @returns { Promise<void> } The promise returned by the flush.
2666     * @syscap SystemCapability.Communication.NetStack
2667     * @crossplatform
2668     * @since 10
2669     */
2670    /**
2671     * Writes data in the cache to the file system so that all the cached data can be accessed in the next HTTP request.
2672     * @returns { Promise<void> } The promise returned by the flush.
2673     * @syscap SystemCapability.Communication.NetStack
2674     * @crossplatform
2675     * @atomicservice
2676     * @since 11
2677     */
2678    flush(): Promise<void>;
2679
2680    /**
2681     * Disables a cache and deletes the data in it.
2682     * @param { AsyncCallback<void> } callback - the callback of delete.
2683     * @syscap SystemCapability.Communication.NetStack
2684     * @since 9
2685     */
2686    /**
2687     * Disables a cache and deletes the data in it.
2688     * @param { AsyncCallback<void> } callback - the callback of delete.
2689     * @syscap SystemCapability.Communication.NetStack
2690     * @crossplatform
2691     * @since 10
2692     */
2693    /**
2694     * Disables a cache and deletes the data in it.
2695     * @param { AsyncCallback<void> } callback - the callback of delete.
2696     * @syscap SystemCapability.Communication.NetStack
2697     * @crossplatform
2698     * @atomicservice
2699     * @since 11
2700     */
2701    delete(callback: AsyncCallback<void>): void;
2702
2703    /**
2704     * Disables a cache and deletes the data in it.
2705     * @returns { Promise<void> } The promise returned by the delete.
2706     * @syscap SystemCapability.Communication.NetStack
2707     * @since 9
2708     */
2709    /**
2710     * Disables a cache and deletes the data in it.
2711     * @returns { Promise<void> } The promise returned by the delete.
2712     * @syscap SystemCapability.Communication.NetStack
2713     * @crossplatform
2714     * @since 10
2715     */
2716    /**
2717     * Disables a cache and deletes the data in it.
2718     * @returns { Promise<void> } The promise returned by the delete.
2719     * @syscap SystemCapability.Communication.NetStack
2720     * @crossplatform
2721     * @atomicservice
2722     * @since 11
2723     */
2724    delete(): Promise<void>;
2725  }
2726}
2727
2728export default http;
2729