• 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
16/**
17 * @file
18 * @kit NetworkKit
19 */
20
21import type { AsyncCallback, Callback } from './@ohos.base';
22import type connection from './@ohos.net.connection';
23
24/**
25 * Provides http related APIs.
26 * @namespace http
27 * @syscap SystemCapability.Communication.NetStack
28 * @since 6
29 */
30/**
31 * Provides http related APIs.
32 * @namespace http
33 * @syscap SystemCapability.Communication.NetStack
34 * @crossplatform
35 * @since 10
36 */
37/**
38 * Provides http related APIs.
39 * @namespace http
40 * @syscap SystemCapability.Communication.NetStack
41 * @crossplatform
42 * @atomicservice
43 * @since 11
44 */
45declare namespace http {
46  /**
47   * @syscap SystemCapability.Communication.NetStack
48   * @since 10
49   */
50  /**
51   * @syscap SystemCapability.Communication.NetStack
52   * @atomicservice
53   * @since 11
54   */
55  /**
56   * @typedef { connection.HttpProxy }
57   * @syscap SystemCapability.Communication.NetStack
58   * @crossplatform
59   * @atomicservice
60   * @since 12
61   */
62  type HttpProxy = connection.HttpProxy;
63
64  /**
65   * Creates an HTTP request task.
66   * @returns { HttpRequest } the HttpRequest of the createHttp.
67   * @syscap SystemCapability.Communication.NetStack
68   * @since 6
69   */
70  /**
71   * Creates an HTTP request task.
72   * @returns { HttpRequest } the HttpRequest of the createHttp.
73   * @syscap SystemCapability.Communication.NetStack
74   * @crossplatform
75   * @since 10
76   */
77  /**
78   * Creates an HTTP request task.
79   * @returns { HttpRequest } the HttpRequest of the createHttp.
80   * @syscap SystemCapability.Communication.NetStack
81   * @crossplatform
82   * @atomicservice
83   * @since 11
84   */
85  function createHttp(): HttpRequest;
86
87  /**
88   * Enum for Address Family
89   * @enum {string}
90   * @syscap SystemCapability.Communication.NetStack
91   * @since 15
92   */
93  export enum AddressFamily {
94    /**
95     * Default, can use addresses of all IP versions that your system allows.
96     * @syscap SystemCapability.Communication.NetStack
97     * @since 15
98     */
99    DEFAULT = 'CURL_IPRESOLVE_WHATEVER',
100
101    /**
102     * ONLYV4 Uses only IPv4 addresses.
103     * @syscap SystemCapability.Communication.NetStack
104     * @since 15
105     */
106    ONLY_V4 = 'CURL_IPRESOLVE_V4',
107
108    /**
109     * ONLYV6 Uses only IPv6 addresses.
110     * @syscap SystemCapability.Communication.NetStack
111     * @since 15
112     */
113    ONLY_V6 = 'CURL_IPRESOLVE_V6'
114  }
115
116  /**
117   * Specifies the type and value range of the optional parameters in the HTTP request.
118   * @interface HttpRequestOptions
119   * @syscap SystemCapability.Communication.NetStack
120   * @since 6
121   */
122  /**
123   * Specifies the type and value range of the optional parameters in the HTTP request.
124   * @interface HttpRequestOptions
125   * @syscap SystemCapability.Communication.NetStack
126   * @crossplatform
127   * @since 10
128   */
129  /**
130   * Specifies the type and value range of the optional parameters in the HTTP request.
131   * @interface HttpRequestOptions
132   * @syscap SystemCapability.Communication.NetStack
133   * @crossplatform
134   * @atomicservice
135   * @since 11
136   */
137  export interface HttpRequestOptions {
138    /**
139     * Request method,default is GET.
140     * @type {?RequestMethod}
141     * @syscap SystemCapability.Communication.NetStack
142     * @since 6
143     */
144    /**
145     * Request method,default is GET.
146     * @type {?RequestMethod}
147     * @syscap SystemCapability.Communication.NetStack
148     * @crossplatform
149     * @since 10
150     */
151    /**
152     * Request method,default is GET.
153     * @type {?RequestMethod}
154     * @syscap SystemCapability.Communication.NetStack
155     * @crossplatform
156     * @atomicservice
157     * @since 11
158     */
159    method?: RequestMethod;
160
161    /**
162     * Additional data of the request.
163     * extraData can be a string or an Object (API 6) or an ArrayBuffer(API 8).
164     * @type {?string | Object | ArrayBuffer}
165     * @syscap SystemCapability.Communication.NetStack
166     * @since 6
167     */
168    /**
169     * Additional data of the request.
170     * extraData can be a string or an Object (API 6) or an ArrayBuffer(API 8).
171     * @type {?string | Object | ArrayBuffer}
172     * @syscap SystemCapability.Communication.NetStack
173     * @crossplatform
174     * @since 10
175     */
176    /**
177     * Additional data of the request.
178     * extraData can be a string or an Object (API 6) or an ArrayBuffer(API 8).
179     * @type { ?(string | Object | ArrayBuffer) }
180     * @syscap SystemCapability.Communication.NetStack
181     * @crossplatform
182     * @atomicservice
183     * @since 11
184     */
185    extraData?: string | Object | ArrayBuffer;
186
187    /**
188     * Data type to be returned. If this parameter is set, the system preferentially returns the specified type.
189     * @type {?HttpDataType}
190     * @syscap SystemCapability.Communication.NetStack
191     * @since 9
192     */
193    /**
194     * Data type to be returned. If this parameter is set, the system preferentially returns the specified type.
195     * @type {?HttpDataType}
196     * @syscap SystemCapability.Communication.NetStack
197     * @crossplatform
198     * @since 10
199     */
200    /**
201     * Data type to be returned. If this parameter is set, the system preferentially returns the specified type.
202     * @type {?HttpDataType}
203     * @syscap SystemCapability.Communication.NetStack
204     * @crossplatform
205     * @atomicservice
206     * @since 11
207     */
208    expectDataType?: HttpDataType;
209
210    /**
211     * default is true
212     * @type {?boolean}
213     * @syscap SystemCapability.Communication.NetStack
214     * @since 9
215     */
216    /**
217     * default is true
218     * @type {?boolean}
219     * @syscap SystemCapability.Communication.NetStack
220     * @crossplatform
221     * @since 10
222     */
223    /**
224     * default is true
225     * @type {?boolean}
226     * @syscap SystemCapability.Communication.NetStack
227     * @crossplatform
228     * @atomicservice
229     * @since 11
230     */
231    usingCache?: boolean;
232
233    /**
234     * [1, 1000], default is 1.
235     * @type {?number}
236     * @syscap SystemCapability.Communication.NetStack
237     * @since 9
238     */
239    /**
240     * [1, 1000], default is 1.
241     * @type {?number}
242     * @syscap SystemCapability.Communication.NetStack
243     * @crossplatform
244     * @since 10
245     */
246    /**
247     * [1, 1000], default is 1.
248     * @type {?number}
249     * @syscap SystemCapability.Communication.NetStack
250     * @crossplatform
251     * @atomicservice
252     * @since 11
253     */
254    priority?: number;
255
256    /**
257     * HTTP request header. default is 'content-type': 'application/json'
258     * @type {?Object}
259     * @syscap SystemCapability.Communication.NetStack
260     * @since 6
261     */
262    /**
263     * HTTP request header. default is 'content-type': 'application/json'
264     * @type {?Object}
265     * @syscap SystemCapability.Communication.NetStack
266     * @crossplatform
267     * @since 10
268     */
269    /**
270     * HTTP request header. default is 'content-type': 'application/json'
271     * @type {?Object}
272     * @syscap SystemCapability.Communication.NetStack
273     * @crossplatform
274     * @atomicservice
275     * @since 11
276     */
277    header?: Object;
278
279    /**
280     * Read timeout period. The default value is 60,000, in ms.
281     * @type {?number}
282     * @syscap SystemCapability.Communication.NetStack
283     * @since 6
284     */
285    /**
286     * Read timeout period. The default value is 60,000, in ms.
287     * @type {?number}
288     * @syscap SystemCapability.Communication.NetStack
289     * @crossplatform
290     * @since 10
291     */
292    /**
293     * Read timeout period. The default value is 60,000, in ms.
294     * @type {?number}
295     * @syscap SystemCapability.Communication.NetStack
296     * @crossplatform
297     * @atomicservice
298     * @since 11
299     */
300    readTimeout?: number;
301
302    /**
303     * Connection timeout interval. The default value is 60,000, in ms.
304     * @type {?number}
305     * @syscap SystemCapability.Communication.NetStack
306     * @since 6
307     */
308    /**
309     * Connection timeout interval. The default value is 60,000, in ms.
310     * @type {?number}
311     * @syscap SystemCapability.Communication.NetStack
312     * @crossplatform
313     * @since 10
314     */
315    /**
316     * Connection timeout interval. The default value is 60,000, in ms.
317     * @type {?number}
318     * @syscap SystemCapability.Communication.NetStack
319     * @crossplatform
320     * @atomicservice
321     * @since 11
322     */
323    connectTimeout?: number;
324
325    /**
326     * default is automatically specified by the system.
327     * @type {?HttpProtocol}
328     * @syscap SystemCapability.Communication.NetStack
329     * @since 9
330     */
331    /**
332     * default is automatically specified by the system.
333     * @type {?HttpProtocol}
334     * @syscap SystemCapability.Communication.NetStack
335     * @crossplatform
336     * @since 10
337     */
338    /**
339     * default is automatically specified by the system.
340     * @type {?HttpProtocol}
341     * @syscap SystemCapability.Communication.NetStack
342     * @crossplatform
343     * @atomicservice
344     * @since 11
345     */
346    usingProtocol?: HttpProtocol;
347
348    /**
349     * If this parameter is set as type of boolean, the system will use default proxy or not use proxy.
350     * If this parameter is set as type of HttpProxy, the system will use the specified HttpProxy.
351     * @type {?boolean | HttpProxy}
352     * @syscap SystemCapability.Communication.NetStack
353     * @since 10
354     */
355    /**
356     * If this parameter is set as type of boolean, the system will use default proxy or not use proxy.
357     * If this parameter is set as type of HttpProxy, the system will use the specified HttpProxy.
358     * @type { ?(boolean | HttpProxy) }
359     * @syscap SystemCapability.Communication.NetStack
360     * @atomicservice
361     * @since 11
362     */
363    /**
364     * If this parameter is set as type of boolean, the system will use default proxy or not use proxy.
365     * If this parameter is set as type of HttpProxy, the system will use the specified HttpProxy.
366     * @type { ?(boolean | HttpProxy) }
367     * @syscap SystemCapability.Communication.NetStack
368     * @crossplatform
369     * @atomicservice
370     * @since 12
371     */
372    usingProxy?: boolean | HttpProxy;
373
374    /**
375     * If this parameter is set, the system will use ca path specified by user, or else use preset ca by the system.
376     * @type {?string}
377     * @syscap SystemCapability.Communication.NetStack
378     * @since 10
379     */
380    /**
381     * If this parameter is set, the system will use ca path specified by user, or else use preset ca by the system.
382     * @type {?string}
383     * @syscap SystemCapability.Communication.NetStack
384     * @atomicservice
385     * @since 11
386     */
387    /**
388     * If this parameter is set, the system will use ca path specified by user, or else use preset ca by the system.
389     * @type {?string}
390     * @syscap SystemCapability.Communication.NetStack
391     * @crossplatform
392     * @atomicservice
393     * @since 12
394     */
395    caPath?: string;
396
397    /**
398     * Used to set to uploading or downloading the start bytes. The default value is 0.
399     * HTTP standard (RFC 7233 section 3.1) allows servers to ignore range requests.
400     * For HTTP PUT uploads this option should not be used, since it may conflict with other options.
401     * @type {?number}
402     * @syscap SystemCapability.Communication.NetStack
403     * @since 11
404     */
405    /**
406     * Used to set to uploading or downloading the start bytes. The default value is 0.
407     * HTTP standard (RFC 7233 section 3.1) allows servers to ignore range requests.
408     * For HTTP PUT uploads this option should not be used, since it may conflict with other options.
409     * @type {?number}
410     * @syscap SystemCapability.Communication.NetStack
411     * @crossplatform
412     * @since 12
413     */
414    resumeFrom?: number;
415
416    /**
417     * Used to set to uploading or downloading the end bytes. Translate to the end if not set.
418     * HTTP standard (RFC 7233 section 3.1) allows servers to ignore range requests.
419     * For HTTP PUT uploads this option should not be used, since it may conflict with other options.
420     * @type {?number}
421     * @syscap SystemCapability.Communication.NetStack
422     * @since 11
423     */
424    /**
425     * Used to set to uploading or downloading the end bytes. Translate to the end if not set.
426     * HTTP standard (RFC 7233 section 3.1) allows servers to ignore range requests.
427     * For HTTP PUT uploads this option should not be used, since it may conflict with other options.
428     * @type {?number}
429     * @syscap SystemCapability.Communication.NetStack
430     * @crossplatform
431     * @since 12
432     */
433    resumeTo?: number;
434
435    /**
436     * Support the application to pass in client certificates, allowing the server to verify the client's identity.
437     * @type {?ClientCert}
438     * @syscap SystemCapability.Communication.NetStack
439     * @since 11
440     */
441    /**
442     * Support the application to pass in client certificates, allowing the server to verify the client's identity.
443     * @type {?ClientCert}
444     * @syscap SystemCapability.Communication.NetStack
445     * @crossplatform
446     * @since 12
447     */
448    clientCert?: ClientCert;
449
450    /**
451     * If this parameter is set, incoming DNS resolution server URL for the DoH server to use for name resolving.
452     * The parameter must be URL-encoded in the following format: "https://host:port/path".
453     * It MUST specify an HTTPS URL.
454     * @type {?string}
455     * @syscap SystemCapability.Communication.NetStack
456     * @since 11
457     */
458    /**
459     * If this parameter is set, incoming DNS resolution server URL for the DoH server to use for name resolving.
460     * The parameter must be URL-encoded in the following format: "https://host:port/path".
461     * It MUST specify an HTTPS URL.
462     * @type {?string}
463     * @syscap SystemCapability.Communication.NetStack
464     * @crossplatform
465     * @since 12
466     */
467    dnsOverHttps?: string;
468
469    /**
470     * If this parameter is set, use the specified DNS server for DNS resolution.
471     * Multiple DNS resolution servers can be set up, with a maximum of 3 servers.
472     * Only take the first three if there are more than three.
473     * @type {?Array<string>}
474     * @syscap SystemCapability.Communication.NetStack
475     * @since 11
476     */
477    /**
478     * If this parameter is set, use the specified DNS server for DNS resolution.
479     * Multiple DNS resolution servers can be set up, with a maximum of 3 servers.
480     * Only take the first three if there are more than three.
481     * @type {?Array<string>}
482     * @syscap SystemCapability.Communication.NetStack
483     * @crossplatform
484     * @since 12
485     */
486    dnsServers?: Array<string>;
487
488    /**
489     * The maximum limit of the response body. The default value is 5 * 1024 * 1024, in Byte.
490     * The maximum value is 100 * 1024 *1024, in Byte.
491     * @type {?number}
492     * @syscap SystemCapability.Communication.NetStack
493     * @since 11
494     */
495    /**
496     * The maximum limit of the response body. The default value is 5 * 1024 * 1024, in Byte.
497     * The maximum value is 100 * 1024 *1024, in Byte.
498     * @type {?number}
499     * @syscap SystemCapability.Communication.NetStack
500     * @crossplatform
501     * @since 12
502     */
503    maxLimit?: number;
504
505    /**
506     * The data fields which is supported by the HTTP protocol to post
507     * forms and by the SMTP and IMAP protocols to provide
508     * the email data to send/upload.
509     * @type {?Array<MultiFormData>}
510     * @syscap SystemCapability.Communication.NetStack
511     * @since 11
512     */
513    /**
514     * The data fields which is supported by the HTTP protocol to post
515     * forms and by the SMTP and IMAP protocols to provide
516     * the email data to send/upload.
517     * @type {?Array<MultiFormData>}
518     * @syscap SystemCapability.Communication.NetStack
519     * @crossplatform
520     * @since 12
521     */
522    multiFormDataList?: Array<MultiFormData>;
523
524    /**
525     * Certificate pinning option. If server certificate's digest does not match
526     * {@link CertificatePinning.publicKeyHash}, request will fail.
527     * @type {?(CertificatePinning | CertificatePinning[])}
528     * @syscap SystemCapability.Communication.NetStack
529     * @since 12
530     */
531    certificatePinning?: CertificatePinning | CertificatePinning[];
532
533    /**
534     * Address family option.
535     * @type {?AddressFamily}
536     * @syscap SystemCapability.Communication.NetStack
537     * @since 15
538     */
539    addressFamily?: AddressFamily;
540  }
541
542  /**
543   * Represents the properties of a form object.
544   * @interface MultiFormData
545   * @syscap SystemCapability.Communication.NetStack
546   * @since 11
547   */
548  /**
549   * Represents the properties of a form object.
550   * @interface MultiFormData
551   * @syscap SystemCapability.Communication.NetStack
552   * @crossplatform
553   * @since 12
554   */
555  export interface MultiFormData {
556    /**
557     * MIME name for the data field.
558     * @type {string}
559     * @syscap SystemCapability.Communication.NetStack
560     * @since 11
561     */
562    /**
563     * MIME name for the data field.
564     * @type {string}
565     * @syscap SystemCapability.Communication.NetStack
566     * @crossplatform
567     * @since 12
568     */
569    name: string;
570
571    /**
572     * Content type of the data field.
573     * @type {string}
574     * @syscap SystemCapability.Communication.NetStack
575     * @since 11
576     */
577    /**
578     * Content type of the data field.
579     * @type {string}
580     * @syscap SystemCapability.Communication.NetStack
581     * @crossplatform
582     * @since 12
583     */
584    contentType: string;
585
586    /**
587     * Remote file name for the data field.
588     * @type {?string}
589     * @syscap SystemCapability.Communication.NetStack
590     * @since 11
591     */
592    /**
593     * Remote file name for the data field.
594     * @type {?string}
595     * @syscap SystemCapability.Communication.NetStack
596     * @crossplatform
597     * @since 12
598     */
599    remoteFileName?: string;
600
601    /**
602     * This parameter sets a mime part's body content from memory data.
603     * @type {?(string | Object | ArrayBuffer)}
604     * @syscap SystemCapability.Communication.NetStack
605     * @since 11
606     */
607    /**
608     * This parameter sets a mime part's body content from memory data.
609     * @type {?(string | Object | ArrayBuffer)}
610     * @syscap SystemCapability.Communication.NetStack
611     * @crossplatform
612     * @since 12
613     */
614    data?: string | Object | ArrayBuffer;
615
616    /**
617     * This parameter sets a mime part's body content from the file's contents.
618     * This is an alternative to curl_mime_data for setting data to a mime part.
619     * If data is empty, filePath must be set.
620     * If data has a value, filePath does not take effect.
621     * @type {?string}
622     * @syscap SystemCapability.Communication.NetStack
623     * @since 11
624     */
625    /**
626     * This parameter sets a mime part's body content from the file's contents.
627     * This is an alternative to curl_mime_data for setting data to a mime part.
628     * If data is empty, filePath must be set.
629     * If data has a value, filePath does not take effect.
630     * @type {?string}
631     * @syscap SystemCapability.Communication.NetStack
632     * @crossplatform
633     * @since 12
634     */
635    filePath?: string;
636  }
637
638  /**
639   * Enum for certificate types
640   * @enum {string}
641   * @syscap SystemCapability.Communication.NetStack
642   * @since 11
643   */
644  /**
645   * Enum for certificate types
646   * @enum {string}
647   * @syscap SystemCapability.Communication.NetStack
648   * @crossplatform
649   * @since 12
650   */
651  export enum CertType {
652    /**
653     * PEM format certificate
654     * @syscap SystemCapability.Communication.NetStack
655     * @since 11
656     */
657    /**
658     * PEM format certificate
659     * @syscap SystemCapability.Communication.NetStack
660     * @crossplatform
661     * @since 12
662     */
663    PEM = 'PEM',
664
665    /**
666     * DER format certificate
667     * @syscap SystemCapability.Communication.NetStack
668     * @since 11
669     */
670    /**
671     * DER format certificate
672     * @syscap SystemCapability.Communication.NetStack
673     * @crossplatform
674     * @since 12
675     */
676    DER = 'DER',
677
678    /**
679     * P12 format certificate
680     * @syscap SystemCapability.Communication.NetStack
681     * @since 11
682     */
683    /**
684     * P12 format certificate
685     * @syscap SystemCapability.Communication.NetStack
686     * @crossplatform
687     * @since 12
688     */
689    P12 = 'P12'
690  }
691
692  /**
693   * The clientCert field of the client certificate, which includes 4 attributes:
694   * client certificate (cert), client certificate type (certType), certificate private key (key), and passphrase (keyPassword).
695   * @interface ClientCert
696   * @syscap SystemCapability.Communication.NetStack
697   * @since 11
698   */
699  /**
700   * The clientCert field of the client certificate, which includes 4 attributes:
701   * client certificate (cert), client certificate type (certType), certificate private key (key), and passphrase (keyPassword).
702   * @interface ClientCert
703   * @syscap SystemCapability.Communication.NetStack
704   * @crossplatform
705   * @since 12
706   */
707  export interface ClientCert {
708    /**
709     * The path to the client certificate file.
710     * @type {string}
711     * @syscap SystemCapability.Communication.NetStack
712     * @since 11
713     */
714    /**
715     * The path to the client certificate file.
716     * @type {string}
717     * @syscap SystemCapability.Communication.NetStack
718     * @crossplatform
719     * @since 12
720     */
721    certPath: string;
722
723    /**
724     * The type of the client certificate.
725     * @type {?CertType}
726     * @syscap SystemCapability.Communication.NetStack
727     * @since 11
728     */
729    /**
730     * The type of the client certificate.
731     * @type {?CertType}
732     * @syscap SystemCapability.Communication.NetStack
733     * @crossplatform
734     * @since 12
735     */
736    certType?: CertType;
737
738    /**
739     * The path of the client certificate private key file.
740     * @type {string}
741     * @syscap SystemCapability.Communication.NetStack
742     * @since 11
743     */
744    /**
745     * The path of the client certificate private key file.
746     * @type {string}
747     * @syscap SystemCapability.Communication.NetStack
748     * @crossplatform
749     * @since 12
750     */
751    keyPath: string;
752
753    /**
754     * Password required to use the client certificate private key.
755     * @type {?string}
756     * @syscap SystemCapability.Communication.NetStack
757     * @since 11
758     */
759    /**
760     * Password required to use the client certificate private key.
761     * @type {?string}
762     * @syscap SystemCapability.Communication.NetStack
763     * @crossplatform
764     * @since 12
765     */
766    keyPassword?: string;
767  }
768
769  /**
770   * Certificate pinning option.
771   * @interface CertificatePinning
772   * @syscap SystemCapability.Communication.NetStack
773   * @since 12
774   */
775  interface CertificatePinning {
776    /**
777     * Public key hash.
778     * @type {string}
779     * @syscap SystemCapability.Communication.NetStack
780     * @since 12
781     */
782    publicKeyHash: string;
783    /**
784     * Certificate public key hash algorithm.
785     * @type {'SHA-256'}
786     * @syscap SystemCapability.Communication.NetStack
787     * @since 12
788     */
789    hashAlgorithm: 'SHA-256';
790  }
791
792  /**
793   * <p>Defines an HTTP request task. Before invoking APIs provided by HttpRequest,
794   * you must call createHttp() to create an HttpRequestTask object.</p>
795   * @interface HttpRequest
796   * @syscap SystemCapability.Communication.NetStack
797   * @since 6
798   */
799  /**
800   * <p>Defines an HTTP request task. Before invoking APIs provided by HttpRequest,
801   * you must call createHttp() to create an HttpRequestTask object.</p>
802   * @interface HttpRequest
803   * @syscap SystemCapability.Communication.NetStack
804   * @crossplatform
805   * @since 10
806   */
807  /**
808   * <p>Defines an HTTP request task. Before invoking APIs provided by HttpRequest,
809   * you must call createHttp() to create an HttpRequestTask object.</p>
810   * @interface HttpRequest
811   * @syscap SystemCapability.Communication.NetStack
812   * @crossplatform
813   * @atomicservice
814   * @since 11
815   */
816  export interface HttpRequest {
817    /**
818     * Initiates an HTTP request to a given URL.
819     * @permission ohos.permission.INTERNET
820     * @param { string } url - URL for initiating an HTTP request.
821     * @param { AsyncCallback<HttpResponse> } callback - the callback of request.
822     * @throws { BusinessError } 401 - Parameter error.
823     * @throws { BusinessError } 201 - Permission denied.
824     * @throws { BusinessError } 2300001 - Unsupported protocol.
825     * @throws { BusinessError } 2300003 - Invalid URL format or missing URL.
826     * @throws { BusinessError } 2300005 - Failed to resolve the proxy name.
827     * @throws { BusinessError } 2300006 - Failed to resolve the host name.
828     * @throws { BusinessError } 2300007 - Failed to connect to the server.
829     * @throws { BusinessError } 2300008 - Invalid server response.
830     * @throws { BusinessError } 2300009 - Access to the remote resource denied.
831     * @throws { BusinessError } 2300016 - Error in the HTTP2 framing layer.
832     * @throws { BusinessError } 2300018 - Transferred a partial file.
833     * @throws { BusinessError } 2300023 - Failed to write the received data to the disk or application.
834     * @throws { BusinessError } 2300025 - Upload failed.
835     * @throws { BusinessError } 2300026 - Failed to open or read local data from the file or application.
836     * @throws { BusinessError } 2300027 - Out of memory.
837     * @throws { BusinessError } 2300028 - Operation timeout.
838     * @throws { BusinessError } 2300047 - The number of redirections reaches the maximum allowed.
839     * @throws { BusinessError } 2300052 - The server returned nothing (no header or data).
840     * @throws { BusinessError } 2300055 - Failed to send data to the peer.
841     * @throws { BusinessError } 2300056 - Failed to receive data from the peer.
842     * @throws { BusinessError } 2300058 - Local SSL certificate error.
843     * @throws { BusinessError } 2300059 - The specified SSL cipher cannot be used.
844     * @throws { BusinessError } 2300060 - Invalid SSL peer certificate or SSH remote key.
845     * @throws { BusinessError } 2300061 - Invalid HTTP encoding format.
846     * @throws { BusinessError } 2300063 - Maximum file size exceeded.
847     * @throws { BusinessError } 2300070 - Remote disk full.
848     * @throws { BusinessError } 2300073 - Remote file already exists.
849     * @throws { BusinessError } 2300077 - The SSL CA certificate does not exist or is inaccessible.
850     * @throws { BusinessError } 2300078 - Remote file not found.
851     * @throws { BusinessError } 2300094 - Authentication error.
852     * @throws { BusinessError } 2300999 - Unknown error.
853     * @syscap SystemCapability.Communication.NetStack
854     * @since 6
855     */
856    /**
857     * Initiates an HTTP request to a given URL.
858     * @permission ohos.permission.INTERNET
859     * @param { string } url - URL for initiating an HTTP request.
860     * @param { AsyncCallback<HttpResponse> } callback - the callback of request.
861     * @throws { BusinessError } 401 - Parameter error.
862     * @throws { BusinessError } 201 - Permission denied.
863     * @throws { BusinessError } 2300001 - Unsupported protocol.
864     * @throws { BusinessError } 2300003 - Invalid URL format or missing URL.
865     * @throws { BusinessError } 2300005 - Failed to resolve the proxy name.
866     * @throws { BusinessError } 2300006 - Failed to resolve the host name.
867     * @throws { BusinessError } 2300007 - Failed to connect to the server.
868     * @throws { BusinessError } 2300008 - Invalid server response.
869     * @throws { BusinessError } 2300009 - Access to the remote resource denied.
870     * @throws { BusinessError } 2300016 - Error in the HTTP2 framing layer.
871     * @throws { BusinessError } 2300018 - Transferred a partial file.
872     * @throws { BusinessError } 2300023 - Failed to write the received data to the disk or application.
873     * @throws { BusinessError } 2300025 - Upload failed.
874     * @throws { BusinessError } 2300026 - Failed to open or read local data from the file or application.
875     * @throws { BusinessError } 2300027 - Out of memory.
876     * @throws { BusinessError } 2300028 - Operation timeout.
877     * @throws { BusinessError } 2300047 - The number of redirections reaches the maximum allowed.
878     * @throws { BusinessError } 2300052 - The server returned nothing (no header or data).
879     * @throws { BusinessError } 2300055 - Failed to send data to the peer.
880     * @throws { BusinessError } 2300056 - Failed to receive data from the peer.
881     * @throws { BusinessError } 2300058 - Local SSL certificate error.
882     * @throws { BusinessError } 2300059 - The specified SSL cipher cannot be used.
883     * @throws { BusinessError } 2300060 - Invalid SSL peer certificate or SSH remote key.
884     * @throws { BusinessError } 2300061 - Invalid HTTP encoding format.
885     * @throws { BusinessError } 2300063 - Maximum file size exceeded.
886     * @throws { BusinessError } 2300070 - Remote disk full.
887     * @throws { BusinessError } 2300073 - Remote file already exists.
888     * @throws { BusinessError } 2300077 - The SSL CA certificate does not exist or is inaccessible.
889     * @throws { BusinessError } 2300078 - Remote file not found.
890     * @throws { BusinessError } 2300094 - Authentication error.
891     * @throws { BusinessError } 2300999 - Unknown error.
892     * @syscap SystemCapability.Communication.NetStack
893     * @crossplatform
894     * @since 10
895     */
896    /**
897     * Initiates an HTTP request to a given URL.
898     * @permission ohos.permission.INTERNET
899     * @param { string } url - URL for initiating an HTTP request.
900     * @param { AsyncCallback<HttpResponse> } callback - the callback of request.
901     * @throws { BusinessError } 401 - Parameter error.
902     * @throws { BusinessError } 201 - Permission denied.
903     * @throws { BusinessError } 2300001 - Unsupported protocol.
904     * @throws { BusinessError } 2300003 - Invalid URL format or missing URL.
905     * @throws { BusinessError } 2300005 - Failed to resolve the proxy name.
906     * @throws { BusinessError } 2300006 - Failed to resolve the host name.
907     * @throws { BusinessError } 2300007 - Failed to connect to the server.
908     * @throws { BusinessError } 2300008 - Invalid server response.
909     * @throws { BusinessError } 2300009 - Access to the remote resource denied.
910     * @throws { BusinessError } 2300016 - Error in the HTTP2 framing layer.
911     * @throws { BusinessError } 2300018 - Transferred a partial file.
912     * @throws { BusinessError } 2300023 - Failed to write the received data to the disk or application.
913     * @throws { BusinessError } 2300025 - Upload failed.
914     * @throws { BusinessError } 2300026 - Failed to open or read local data from the file or application.
915     * @throws { BusinessError } 2300027 - Out of memory.
916     * @throws { BusinessError } 2300028 - Operation timeout.
917     * @throws { BusinessError } 2300047 - The number of redirections reaches the maximum allowed.
918     * @throws { BusinessError } 2300052 - The server returned nothing (no header or data).
919     * @throws { BusinessError } 2300055 - Failed to send data to the peer.
920     * @throws { BusinessError } 2300056 - Failed to receive data from the peer.
921     * @throws { BusinessError } 2300058 - Local SSL certificate error.
922     * @throws { BusinessError } 2300059 - The specified SSL cipher cannot be used.
923     * @throws { BusinessError } 2300060 - Invalid SSL peer certificate or SSH remote key.
924     * @throws { BusinessError } 2300061 - Invalid HTTP encoding format.
925     * @throws { BusinessError } 2300063 - Maximum file size exceeded.
926     * @throws { BusinessError } 2300070 - Remote disk full.
927     * @throws { BusinessError } 2300073 - Remote file already exists.
928     * @throws { BusinessError } 2300077 - The SSL CA certificate does not exist or is inaccessible.
929     * @throws { BusinessError } 2300078 - Remote file not found.
930     * @throws { BusinessError } 2300094 - Authentication error.
931     * @throws { BusinessError } 2300999 - Unknown error.
932     * @syscap SystemCapability.Communication.NetStack
933     * @crossplatform
934     * @atomicservice
935     * @since 11
936     */
937    request(url: string, callback: AsyncCallback<HttpResponse>): void;
938
939    /**
940     * Initiates an HTTP request to a given URL.
941     * @permission ohos.permission.INTERNET
942     * @param { string } url - URL for initiating an HTTP request.
943     * @param { HttpRequestOptions } options - Optional parameters {@link HttpRequestOptions}.
944     * @param { AsyncCallback<HttpResponse> } callback - the callback of request..
945     * @throws { BusinessError } 401 - Parameter error.
946     * @throws { BusinessError } 201 - Permission denied.
947     * @throws { BusinessError } 2300001 - Unsupported protocol.
948     * @throws { BusinessError } 2300003 - Invalid URL format or missing URL.
949     * @throws { BusinessError } 2300005 - Failed to resolve the proxy name.
950     * @throws { BusinessError } 2300006 - Failed to resolve the host name.
951     * @throws { BusinessError } 2300007 - Failed to connect to the server.
952     * @throws { BusinessError } 2300008 - Invalid server response.
953     * @throws { BusinessError } 2300009 - Access to the remote resource denied.
954     * @throws { BusinessError } 2300016 - Error in the HTTP2 framing layer.
955     * @throws { BusinessError } 2300018 - Transferred a partial file.
956     * @throws { BusinessError } 2300023 - Failed to write the received data to the disk or application.
957     * @throws { BusinessError } 2300025 - Upload failed.
958     * @throws { BusinessError } 2300026 - Failed to open or read local data from the file or application.
959     * @throws { BusinessError } 2300027 - Out of memory.
960     * @throws { BusinessError } 2300028 - Operation timeout.
961     * @throws { BusinessError } 2300047 - The number of redirections reaches the maximum allowed.
962     * @throws { BusinessError } 2300052 - The server returned nothing (no header or data).
963     * @throws { BusinessError } 2300055 - Failed to send data to the peer.
964     * @throws { BusinessError } 2300056 - Failed to receive data from the peer.
965     * @throws { BusinessError } 2300058 - Local SSL certificate error.
966     * @throws { BusinessError } 2300059 - The specified SSL cipher cannot be used.
967     * @throws { BusinessError } 2300060 - Invalid SSL peer certificate or SSH remote key.
968     * @throws { BusinessError } 2300061 - Invalid HTTP encoding format.
969     * @throws { BusinessError } 2300063 - Maximum file size exceeded.
970     * @throws { BusinessError } 2300070 - Remote disk full.
971     * @throws { BusinessError } 2300073 - Remote file already exists.
972     * @throws { BusinessError } 2300077 - The SSL CA certificate does not exist or is inaccessible.
973     * @throws { BusinessError } 2300078 - Remote file not found.
974     * @throws { BusinessError } 2300094 - Authentication error.
975     * @throws { BusinessError } 2300999 - Unknown error.
976     * @syscap SystemCapability.Communication.NetStack
977     * @since 6
978     */
979    /**
980     * Initiates an HTTP request to a given URL.
981     * @permission ohos.permission.INTERNET
982     * @param { string } url - URL for initiating an HTTP request.
983     * @param { HttpRequestOptions } options - Optional parameters {@link HttpRequestOptions}.
984     * @param { AsyncCallback<HttpResponse> } callback - the callback of request.
985     * @throws { BusinessError } 401 - Parameter error.
986     * @throws { BusinessError } 201 - Permission denied.
987     * @throws { BusinessError } 2300001 - Unsupported protocol.
988     * @throws { BusinessError } 2300003 - Invalid URL format or missing URL.
989     * @throws { BusinessError } 2300005 - Failed to resolve the proxy name.
990     * @throws { BusinessError } 2300006 - Failed to resolve the host name.
991     * @throws { BusinessError } 2300007 - Failed to connect to the server.
992     * @throws { BusinessError } 2300008 - Invalid server response.
993     * @throws { BusinessError } 2300009 - Access to the remote resource denied.
994     * @throws { BusinessError } 2300016 - Error in the HTTP2 framing layer.
995     * @throws { BusinessError } 2300018 - Transferred a partial file.
996     * @throws { BusinessError } 2300023 - Failed to write the received data to the disk or application.
997     * @throws { BusinessError } 2300025 - Upload failed.
998     * @throws { BusinessError } 2300026 - Failed to open or read local data from the file or application.
999     * @throws { BusinessError } 2300027 - Out of memory.
1000     * @throws { BusinessError } 2300028 - Operation timeout.
1001     * @throws { BusinessError } 2300047 - The number of redirections reaches the maximum allowed.
1002     * @throws { BusinessError } 2300052 - The server returned nothing (no header or data).
1003     * @throws { BusinessError } 2300055 - Failed to send data to the peer.
1004     * @throws { BusinessError } 2300056 - Failed to receive data from the peer.
1005     * @throws { BusinessError } 2300058 - Local SSL certificate error.
1006     * @throws { BusinessError } 2300059 - The specified SSL cipher cannot be used.
1007     * @throws { BusinessError } 2300060 - Invalid SSL peer certificate or SSH remote key.
1008     * @throws { BusinessError } 2300061 - Invalid HTTP encoding format.
1009     * @throws { BusinessError } 2300063 - Maximum file size exceeded.
1010     * @throws { BusinessError } 2300070 - Remote disk full.
1011     * @throws { BusinessError } 2300073 - Remote file already exists.
1012     * @throws { BusinessError } 2300077 - The SSL CA certificate does not exist or is inaccessible.
1013     * @throws { BusinessError } 2300078 - Remote file not found.
1014     * @throws { BusinessError } 2300094 - Authentication error.
1015     * @throws { BusinessError } 2300999 - Unknown error.
1016     * @syscap SystemCapability.Communication.NetStack
1017     * @crossplatform
1018     * @since 10
1019     */
1020    /**
1021     * Initiates an HTTP request to a given URL.
1022     * @permission ohos.permission.INTERNET
1023     * @param { string } url - URL for initiating an HTTP request.
1024     * @param { HttpRequestOptions } options - Optional parameters {@link HttpRequestOptions}.
1025     * @param { AsyncCallback<HttpResponse> } callback - the callback of request.
1026     * @throws { BusinessError } 401 - Parameter error.
1027     * @throws { BusinessError } 201 - Permission denied.
1028     * @throws { BusinessError } 2300001 - Unsupported protocol.
1029     * @throws { BusinessError } 2300003 - Invalid URL format or missing URL.
1030     * @throws { BusinessError } 2300005 - Failed to resolve the proxy name.
1031     * @throws { BusinessError } 2300006 - Failed to resolve the host name.
1032     * @throws { BusinessError } 2300007 - Failed to connect to the server.
1033     * @throws { BusinessError } 2300008 - Invalid server response.
1034     * @throws { BusinessError } 2300009 - Access to the remote resource denied.
1035     * @throws { BusinessError } 2300016 - Error in the HTTP2 framing layer.
1036     * @throws { BusinessError } 2300018 - Transferred a partial file.
1037     * @throws { BusinessError } 2300023 - Failed to write the received data to the disk or application.
1038     * @throws { BusinessError } 2300025 - Upload failed.
1039     * @throws { BusinessError } 2300026 - Failed to open or read local data from the file or application.
1040     * @throws { BusinessError } 2300027 - Out of memory.
1041     * @throws { BusinessError } 2300028 - Operation timeout.
1042     * @throws { BusinessError } 2300047 - The number of redirections reaches the maximum allowed.
1043     * @throws { BusinessError } 2300052 - The server returned nothing (no header or data).
1044     * @throws { BusinessError } 2300055 - Failed to send data to the peer.
1045     * @throws { BusinessError } 2300056 - Failed to receive data from the peer.
1046     * @throws { BusinessError } 2300058 - Local SSL certificate error.
1047     * @throws { BusinessError } 2300059 - The specified SSL cipher cannot be used.
1048     * @throws { BusinessError } 2300060 - Invalid SSL peer certificate or SSH remote key.
1049     * @throws { BusinessError } 2300061 - Invalid HTTP encoding format.
1050     * @throws { BusinessError } 2300063 - Maximum file size exceeded.
1051     * @throws { BusinessError } 2300070 - Remote disk full.
1052     * @throws { BusinessError } 2300073 - Remote file already exists.
1053     * @throws { BusinessError } 2300077 - The SSL CA certificate does not exist or is inaccessible.
1054     * @throws { BusinessError } 2300078 - Remote file not found.
1055     * @throws { BusinessError } 2300094 - Authentication error.
1056     * @throws { BusinessError } 2300999 - Unknown error.
1057     * @syscap SystemCapability.Communication.NetStack
1058     * @crossplatform
1059     * @atomicservice
1060     * @since 11
1061     */
1062    request(url: string, options: HttpRequestOptions, callback: AsyncCallback<HttpResponse>): void;
1063
1064    /**
1065     * Initiates an HTTP request to a given URL.
1066     * @permission ohos.permission.INTERNET
1067     * @param { string } url - URL for initiating an HTTP request.
1068     * @param { HttpRequestOptions } [options] - Optional parameters {@link HttpRequestOptions}.
1069     * @returns { Promise<HttpResponse> } The promise returned by the function.
1070     * @throws { BusinessError } 401 - Parameter error.
1071     * @throws { BusinessError } 201 - Permission denied.
1072     * @throws { BusinessError } 2300001 - Unsupported protocol.
1073     * @throws { BusinessError } 2300003 - Invalid URL format or missing URL.
1074     * @throws { BusinessError } 2300005 - Failed to resolve the proxy name.
1075     * @throws { BusinessError } 2300006 - Failed to resolve the host name.
1076     * @throws { BusinessError } 2300007 - Failed to connect to the server.
1077     * @throws { BusinessError } 2300008 - Invalid server response.
1078     * @throws { BusinessError } 2300009 - Access to the remote resource denied.
1079     * @throws { BusinessError } 2300016 - Error in the HTTP2 framing layer.
1080     * @throws { BusinessError } 2300018 - Transferred a partial file.
1081     * @throws { BusinessError } 2300023 - Failed to write the received data to the disk or application.
1082     * @throws { BusinessError } 2300025 - Upload failed.
1083     * @throws { BusinessError } 2300026 - Failed to open or read local data from the file or application.
1084     * @throws { BusinessError } 2300027 - Out of memory.
1085     * @throws { BusinessError } 2300028 - Operation timeout.
1086     * @throws { BusinessError } 2300047 - The number of redirections reaches the maximum allowed.
1087     * @throws { BusinessError } 2300052 - The server returned nothing (no header or data).
1088     * @throws { BusinessError } 2300055 - Failed to send data to the peer.
1089     * @throws { BusinessError } 2300056 - Failed to receive data from the peer.
1090     * @throws { BusinessError } 2300058 - Local SSL certificate error.
1091     * @throws { BusinessError } 2300059 - The specified SSL cipher cannot be used.
1092     * @throws { BusinessError } 2300060 - Invalid SSL peer certificate or SSH remote key.
1093     * @throws { BusinessError } 2300061 - Invalid HTTP encoding format.
1094     * @throws { BusinessError } 2300063 - Maximum file size exceeded.
1095     * @throws { BusinessError } 2300070 - Remote disk full.
1096     * @throws { BusinessError } 2300073 - Remote file already exists.
1097     * @throws { BusinessError } 2300077 - The SSL CA certificate does not exist or is inaccessible.
1098     * @throws { BusinessError } 2300078 - Remote file not found.
1099     * @throws { BusinessError } 2300094 - Authentication error.
1100     * @throws { BusinessError } 2300999 - Unknown error.
1101     * @syscap SystemCapability.Communication.NetStack
1102     * @since 6
1103     */
1104    /**
1105     * Initiates an HTTP request to a given URL.
1106     * @permission ohos.permission.INTERNET
1107     * @param { string } url - URL for initiating an HTTP request.
1108     * @param { HttpRequestOptions } [options] - Optional parameters {@link HttpRequestOptions}.
1109     * @returns { Promise<HttpResponse> } The promise returned by the function.
1110     * @throws { BusinessError } 401 - Parameter error.
1111     * @throws { BusinessError } 201 - Permission denied.
1112     * @throws { BusinessError } 2300001 - Unsupported protocol.
1113     * @throws { BusinessError } 2300003 - Invalid URL format or missing URL.
1114     * @throws { BusinessError } 2300005 - Failed to resolve the proxy name.
1115     * @throws { BusinessError } 2300006 - Failed to resolve the host name.
1116     * @throws { BusinessError } 2300007 - Failed to connect to the server.
1117     * @throws { BusinessError } 2300008 - Invalid server response.
1118     * @throws { BusinessError } 2300009 - Access to the remote resource denied.
1119     * @throws { BusinessError } 2300016 - Error in the HTTP2 framing layer.
1120     * @throws { BusinessError } 2300018 - Transferred a partial file.
1121     * @throws { BusinessError } 2300023 - Failed to write the received data to the disk or application.
1122     * @throws { BusinessError } 2300025 - Upload failed.
1123     * @throws { BusinessError } 2300026 - Failed to open or read local data from the file or application.
1124     * @throws { BusinessError } 2300027 - Out of memory.
1125     * @throws { BusinessError } 2300028 - Operation timeout.
1126     * @throws { BusinessError } 2300047 - The number of redirections reaches the maximum allowed.
1127     * @throws { BusinessError } 2300052 - The server returned nothing (no header or data).
1128     * @throws { BusinessError } 2300055 - Failed to send data to the peer.
1129     * @throws { BusinessError } 2300056 - Failed to receive data from the peer.
1130     * @throws { BusinessError } 2300058 - Local SSL certificate error.
1131     * @throws { BusinessError } 2300059 - The specified SSL cipher cannot be used.
1132     * @throws { BusinessError } 2300060 - Invalid SSL peer certificate or SSH remote key.
1133     * @throws { BusinessError } 2300061 - Invalid HTTP encoding format.
1134     * @throws { BusinessError } 2300063 - Maximum file size exceeded.
1135     * @throws { BusinessError } 2300070 - Remote disk full.
1136     * @throws { BusinessError } 2300073 - Remote file already exists.
1137     * @throws { BusinessError } 2300077 - The SSL CA certificate does not exist or is inaccessible.
1138     * @throws { BusinessError } 2300078 - Remote file not found.
1139     * @throws { BusinessError } 2300094 - Authentication error.
1140     * @throws { BusinessError } 2300999 - Unknown error.
1141     * @syscap SystemCapability.Communication.NetStack
1142     * @crossplatform
1143     * @since 10
1144     */
1145    /**
1146     * Initiates an HTTP request to a given URL.
1147     * @permission ohos.permission.INTERNET
1148     * @param { string } url - URL for initiating an HTTP request.
1149     * @param { HttpRequestOptions } [options] - Optional parameters {@link HttpRequestOptions}.
1150     * @returns { Promise<HttpResponse> } The promise returned by the function.
1151     * @throws { BusinessError } 401 - Parameter error.
1152     * @throws { BusinessError } 201 - Permission denied.
1153     * @throws { BusinessError } 2300001 - Unsupported protocol.
1154     * @throws { BusinessError } 2300003 - Invalid URL format or missing URL.
1155     * @throws { BusinessError } 2300005 - Failed to resolve the proxy name.
1156     * @throws { BusinessError } 2300006 - Failed to resolve the host name.
1157     * @throws { BusinessError } 2300007 - Failed to connect to the server.
1158     * @throws { BusinessError } 2300008 - Invalid server response.
1159     * @throws { BusinessError } 2300009 - Access to the remote resource denied.
1160     * @throws { BusinessError } 2300016 - Error in the HTTP2 framing layer.
1161     * @throws { BusinessError } 2300018 - Transferred a partial file.
1162     * @throws { BusinessError } 2300023 - Failed to write the received data to the disk or application.
1163     * @throws { BusinessError } 2300025 - Upload failed.
1164     * @throws { BusinessError } 2300026 - Failed to open or read local data from the file or application.
1165     * @throws { BusinessError } 2300027 - Out of memory.
1166     * @throws { BusinessError } 2300028 - Operation timeout.
1167     * @throws { BusinessError } 2300047 - The number of redirections reaches the maximum allowed.
1168     * @throws { BusinessError } 2300052 - The server returned nothing (no header or data).
1169     * @throws { BusinessError } 2300055 - Failed to send data to the peer.
1170     * @throws { BusinessError } 2300056 - Failed to receive data from the peer.
1171     * @throws { BusinessError } 2300058 - Local SSL certificate error.
1172     * @throws { BusinessError } 2300059 - The specified SSL cipher cannot be used.
1173     * @throws { BusinessError } 2300060 - Invalid SSL peer certificate or SSH remote key.
1174     * @throws { BusinessError } 2300061 - Invalid HTTP encoding format.
1175     * @throws { BusinessError } 2300063 - Maximum file size exceeded.
1176     * @throws { BusinessError } 2300070 - Remote disk full.
1177     * @throws { BusinessError } 2300073 - Remote file already exists.
1178     * @throws { BusinessError } 2300077 - The SSL CA certificate does not exist or is inaccessible.
1179     * @throws { BusinessError } 2300078 - Remote file not found.
1180     * @throws { BusinessError } 2300094 - Authentication error.
1181     * @throws { BusinessError } 2300999 - Unknown error.
1182     * @syscap SystemCapability.Communication.NetStack
1183     * @crossplatform
1184     * @atomicservice
1185     * @since 11
1186     */
1187    request(url: string, options?: HttpRequestOptions): Promise<HttpResponse>;
1188
1189    /**
1190     * Initiates an HTTP request to a given URL, applicable to scenarios where http response supports streaming.
1191     * @permission ohos.permission.INTERNET
1192     * @param { string } url - URL for initiating an HTTP request.
1193     * @param { AsyncCallback<number> } callback - Returns the callback of requestInStream {@link ResponseCode},
1194     * should use on_headersReceive and on_dataReceive to get http response.
1195     * @throws { BusinessError } 401 - Parameter error.
1196     * @throws { BusinessError } 201 - Permission denied.
1197     * @throws { BusinessError } 2300001 - Unsupported protocol.
1198     * @throws { BusinessError } 2300003 - Invalid URL format or missing URL.
1199     * @throws { BusinessError } 2300005 - Failed to resolve the proxy name.
1200     * @throws { BusinessError } 2300006 - Failed to resolve the host name.
1201     * @throws { BusinessError } 2300007 - Failed to connect to the server.
1202     * @throws { BusinessError } 2300008 - Invalid server response.
1203     * @throws { BusinessError } 2300009 - Access to the remote resource denied.
1204     * @throws { BusinessError } 2300016 - Error in the HTTP2 framing layer.
1205     * @throws { BusinessError } 2300018 - Transferred a partial file.
1206     * @throws { BusinessError } 2300023 - Failed to write the received data to the disk or application.
1207     * @throws { BusinessError } 2300025 - Upload failed.
1208     * @throws { BusinessError } 2300026 - Failed to open or read local data from the file or application.
1209     * @throws { BusinessError } 2300027 - Out of memory.
1210     * @throws { BusinessError } 2300028 - Operation timeout.
1211     * @throws { BusinessError } 2300047 - The number of redirections reaches the maximum allowed.
1212     * @throws { BusinessError } 2300052 - The server returned nothing (no header or data).
1213     * @throws { BusinessError } 2300055 - Failed to send data to the peer.
1214     * @throws { BusinessError } 2300056 - Failed to receive data from the peer.
1215     * @throws { BusinessError } 2300058 - Local SSL certificate error.
1216     * @throws { BusinessError } 2300059 - The specified SSL cipher cannot be used.
1217     * @throws { BusinessError } 2300060 - Invalid SSL peer certificate or SSH remote key.
1218     * @throws { BusinessError } 2300061 - Invalid HTTP encoding format.
1219     * @throws { BusinessError } 2300063 - Maximum file size exceeded.
1220     * @throws { BusinessError } 2300070 - Remote disk full.
1221     * @throws { BusinessError } 2300073 - Remote file already exists.
1222     * @throws { BusinessError } 2300077 - The SSL CA certificate does not exist or is inaccessible.
1223     * @throws { BusinessError } 2300078 - Remote file not found.
1224     * @throws { BusinessError } 2300094 - Authentication error.
1225     * @throws { BusinessError } 2300999 - Unknown error.
1226     * @syscap SystemCapability.Communication.NetStack
1227     * @since 10
1228     */
1229    /**
1230     * Initiates an HTTP request to a given URL, applicable to scenarios where http response supports streaming.
1231     * @permission ohos.permission.INTERNET
1232     * @param { string } url - URL for initiating an HTTP request.
1233     * @param { AsyncCallback<number> } callback - Returns the callback of requestInStream {@link ResponseCode},
1234     * should use on_headersReceive and on_dataReceive to get http response.
1235     * @throws { BusinessError } 401 - Parameter error.
1236     * @throws { BusinessError } 201 - Permission denied.
1237     * @throws { BusinessError } 2300001 - Unsupported protocol.
1238     * @throws { BusinessError } 2300003 - Invalid URL format or missing URL.
1239     * @throws { BusinessError } 2300005 - Failed to resolve the proxy name.
1240     * @throws { BusinessError } 2300006 - Failed to resolve the host name.
1241     * @throws { BusinessError } 2300007 - Failed to connect to the server.
1242     * @throws { BusinessError } 2300008 - Invalid server response.
1243     * @throws { BusinessError } 2300009 - Access to the remote resource denied.
1244     * @throws { BusinessError } 2300016 - Error in the HTTP2 framing layer.
1245     * @throws { BusinessError } 2300018 - Transferred a partial file.
1246     * @throws { BusinessError } 2300023 - Failed to write the received data to the disk or application.
1247     * @throws { BusinessError } 2300025 - Upload failed.
1248     * @throws { BusinessError } 2300026 - Failed to open or read local data from the file or application.
1249     * @throws { BusinessError } 2300027 - Out of memory.
1250     * @throws { BusinessError } 2300028 - Operation timeout.
1251     * @throws { BusinessError } 2300047 - The number of redirections reaches the maximum allowed.
1252     * @throws { BusinessError } 2300052 - The server returned nothing (no header or data).
1253     * @throws { BusinessError } 2300055 - Failed to send data to the peer.
1254     * @throws { BusinessError } 2300056 - Failed to receive data from the peer.
1255     * @throws { BusinessError } 2300058 - Local SSL certificate error.
1256     * @throws { BusinessError } 2300059 - The specified SSL cipher cannot be used.
1257     * @throws { BusinessError } 2300060 - Invalid SSL peer certificate or SSH remote key.
1258     * @throws { BusinessError } 2300061 - Invalid HTTP encoding format.
1259     * @throws { BusinessError } 2300063 - Maximum file size exceeded.
1260     * @throws { BusinessError } 2300070 - Remote disk full.
1261     * @throws { BusinessError } 2300073 - Remote file already exists.
1262     * @throws { BusinessError } 2300077 - The SSL CA certificate does not exist or is inaccessible.
1263     * @throws { BusinessError } 2300078 - Remote file not found.
1264     * @throws { BusinessError } 2300094 - Authentication error.
1265     * @throws { BusinessError } 2300998 - It is not allowed to access this domain.
1266     * @throws { BusinessError } 2300999 - Unknown error.
1267     * @syscap SystemCapability.Communication.NetStack
1268     * @since 12
1269     */
1270    /**
1271     * Initiates an HTTP request to a given URL, applicable to scenarios where http response supports streaming.
1272     * @permission ohos.permission.INTERNET
1273     * @param { string } url - URL for initiating an HTTP request.
1274     * @param { AsyncCallback<number> } callback - Returns the callback of requestInStream {@link ResponseCode},
1275     * should use on_headersReceive and on_dataReceive to get http response.
1276     * @throws { BusinessError } 401 - Parameter error.
1277     * @throws { BusinessError } 201 - Permission denied.
1278     * @throws { BusinessError } 2300001 - Unsupported protocol.
1279     * @throws { BusinessError } 2300003 - Invalid URL format or missing URL.
1280     * @throws { BusinessError } 2300005 - Failed to resolve the proxy name.
1281     * @throws { BusinessError } 2300006 - Failed to resolve the host name.
1282     * @throws { BusinessError } 2300007 - Failed to connect to the server.
1283     * @throws { BusinessError } 2300008 - Invalid server response.
1284     * @throws { BusinessError } 2300009 - Access to the remote resource denied.
1285     * @throws { BusinessError } 2300016 - Error in the HTTP2 framing layer.
1286     * @throws { BusinessError } 2300018 - Transferred a partial file.
1287     * @throws { BusinessError } 2300023 - Failed to write the received data to the disk or application.
1288     * @throws { BusinessError } 2300025 - Upload failed.
1289     * @throws { BusinessError } 2300026 - Failed to open or read local data from the file or application.
1290     * @throws { BusinessError } 2300027 - Out of memory.
1291     * @throws { BusinessError } 2300028 - Operation timeout.
1292     * @throws { BusinessError } 2300047 - The number of redirections reaches the maximum allowed.
1293     * @throws { BusinessError } 2300052 - The server returned nothing (no header or data).
1294     * @throws { BusinessError } 2300055 - Failed to send data to the peer.
1295     * @throws { BusinessError } 2300056 - Failed to receive data from the peer.
1296     * @throws { BusinessError } 2300058 - Local SSL certificate error.
1297     * @throws { BusinessError } 2300059 - The specified SSL cipher cannot be used.
1298     * @throws { BusinessError } 2300060 - Invalid SSL peer certificate or SSH remote key.
1299     * @throws { BusinessError } 2300061 - Invalid HTTP encoding format.
1300     * @throws { BusinessError } 2300063 - Maximum file size exceeded.
1301     * @throws { BusinessError } 2300070 - Remote disk full.
1302     * @throws { BusinessError } 2300073 - Remote file already exists.
1303     * @throws { BusinessError } 2300077 - The SSL CA certificate does not exist or is inaccessible.
1304     * @throws { BusinessError } 2300078 - Remote file not found.
1305     * @throws { BusinessError } 2300094 - Authentication error.
1306     * @throws { BusinessError } 2300998 - It is not allowed to access this domain.
1307     * @throws { BusinessError } 2300999 - Unknown error.
1308     * @syscap SystemCapability.Communication.NetStack
1309     * @atomicservice
1310     * @since 15
1311     */
1312    requestInStream(url: string, callback: AsyncCallback<number>): void;
1313
1314    /**
1315     * Initiates an HTTP request to a given URL, applicable to scenarios where http response supports streaming.
1316     * @permission ohos.permission.INTERNET
1317     * @param { string } url - URL for initiating an HTTP request.
1318     * @param { HttpRequestOptions } options - Optional parameters {@link HttpRequestOptions}.
1319     * @param { AsyncCallback<number> } callback - the callback of requestInStream.
1320     * @throws { BusinessError } 401 - Parameter error.
1321     * @throws { BusinessError } 201 - Permission denied.
1322     * @throws { BusinessError } 2300001 - Unsupported protocol.
1323     * @throws { BusinessError } 2300003 - Invalid URL format or missing URL.
1324     * @throws { BusinessError } 2300005 - Failed to resolve the proxy name.
1325     * @throws { BusinessError } 2300006 - Failed to resolve the host name.
1326     * @throws { BusinessError } 2300007 - Failed to connect to the server.
1327     * @throws { BusinessError } 2300008 - Invalid server response.
1328     * @throws { BusinessError } 2300009 - Access to the remote resource denied.
1329     * @throws { BusinessError } 2300016 - Error in the HTTP2 framing layer.
1330     * @throws { BusinessError } 2300018 - Transferred a partial file.
1331     * @throws { BusinessError } 2300023 - Failed to write the received data to the disk or application.
1332     * @throws { BusinessError } 2300025 - Upload failed.
1333     * @throws { BusinessError } 2300026 - Failed to open or read local data from the file or application.
1334     * @throws { BusinessError } 2300027 - Out of memory.
1335     * @throws { BusinessError } 2300028 - Operation timeout.
1336     * @throws { BusinessError } 2300047 - The number of redirections reaches the maximum allowed.
1337     * @throws { BusinessError } 2300052 - The server returned nothing (no header or data).
1338     * @throws { BusinessError } 2300055 - Failed to send data to the peer.
1339     * @throws { BusinessError } 2300056 - Failed to receive data from the peer.
1340     * @throws { BusinessError } 2300058 - Local SSL certificate error.
1341     * @throws { BusinessError } 2300059 - The specified SSL cipher cannot be used.
1342     * @throws { BusinessError } 2300060 - Invalid SSL peer certificate or SSH remote key.
1343     * @throws { BusinessError } 2300061 - Invalid HTTP encoding format.
1344     * @throws { BusinessError } 2300063 - Maximum file size exceeded.
1345     * @throws { BusinessError } 2300070 - Remote disk full.
1346     * @throws { BusinessError } 2300073 - Remote file already exists.
1347     * @throws { BusinessError } 2300077 - The SSL CA certificate does not exist or is inaccessible.
1348     * @throws { BusinessError } 2300078 - Remote file not found.
1349     * @throws { BusinessError } 2300094 - Authentication error.
1350     * @throws { BusinessError } 2300999 - Unknown error.
1351     * @syscap SystemCapability.Communication.NetStack
1352     * @since 10
1353     */
1354    /**
1355     * Initiates an HTTP request to a given URL, applicable to scenarios where http response supports streaming.
1356     * @permission ohos.permission.INTERNET
1357     * @param { string } url - URL for initiating an HTTP request.
1358     * @param { HttpRequestOptions } options - Optional parameters {@link HttpRequestOptions}.
1359     * @param { AsyncCallback<number> } callback - the callback of requestInStream.
1360     * @throws { BusinessError } 401 - Parameter error.
1361     * @throws { BusinessError } 201 - Permission denied.
1362     * @throws { BusinessError } 2300001 - Unsupported protocol.
1363     * @throws { BusinessError } 2300003 - Invalid URL format or missing URL.
1364     * @throws { BusinessError } 2300005 - Failed to resolve the proxy name.
1365     * @throws { BusinessError } 2300006 - Failed to resolve the host name.
1366     * @throws { BusinessError } 2300007 - Failed to connect to the server.
1367     * @throws { BusinessError } 2300008 - Invalid server response.
1368     * @throws { BusinessError } 2300009 - Access to the remote resource denied.
1369     * @throws { BusinessError } 2300016 - Error in the HTTP2 framing layer.
1370     * @throws { BusinessError } 2300018 - Transferred a partial file.
1371     * @throws { BusinessError } 2300023 - Failed to write the received data to the disk or application.
1372     * @throws { BusinessError } 2300025 - Upload failed.
1373     * @throws { BusinessError } 2300026 - Failed to open or read local data from the file or application.
1374     * @throws { BusinessError } 2300027 - Out of memory.
1375     * @throws { BusinessError } 2300028 - Operation timeout.
1376     * @throws { BusinessError } 2300047 - The number of redirections reaches the maximum allowed.
1377     * @throws { BusinessError } 2300052 - The server returned nothing (no header or data).
1378     * @throws { BusinessError } 2300055 - Failed to send data to the peer.
1379     * @throws { BusinessError } 2300056 - Failed to receive data from the peer.
1380     * @throws { BusinessError } 2300058 - Local SSL certificate error.
1381     * @throws { BusinessError } 2300059 - The specified SSL cipher cannot be used.
1382     * @throws { BusinessError } 2300060 - Invalid SSL peer certificate or SSH remote key.
1383     * @throws { BusinessError } 2300061 - Invalid HTTP encoding format.
1384     * @throws { BusinessError } 2300063 - Maximum file size exceeded.
1385     * @throws { BusinessError } 2300070 - Remote disk full.
1386     * @throws { BusinessError } 2300073 - Remote file already exists.
1387     * @throws { BusinessError } 2300077 - The SSL CA certificate does not exist or is inaccessible.
1388     * @throws { BusinessError } 2300078 - Remote file not found.
1389     * @throws { BusinessError } 2300094 - Authentication error.
1390     * @throws { BusinessError } 2300998 - It is not allowed to access this domain.
1391     * @throws { BusinessError } 2300999 - Unknown error.
1392     * @syscap SystemCapability.Communication.NetStack
1393     * @since 12
1394     */
1395    /**
1396     * Initiates an HTTP request to a given URL, applicable to scenarios where http response supports streaming.
1397     * @permission ohos.permission.INTERNET
1398     * @param { string } url - URL for initiating an HTTP request.
1399     * @param { HttpRequestOptions } options - Optional parameters {@link HttpRequestOptions}.
1400     * @param { AsyncCallback<number> } callback - the callback of requestInStream.
1401     * @throws { BusinessError } 401 - Parameter error.
1402     * @throws { BusinessError } 201 - Permission denied.
1403     * @throws { BusinessError } 2300001 - Unsupported protocol.
1404     * @throws { BusinessError } 2300003 - Invalid URL format or missing URL.
1405     * @throws { BusinessError } 2300005 - Failed to resolve the proxy name.
1406     * @throws { BusinessError } 2300006 - Failed to resolve the host name.
1407     * @throws { BusinessError } 2300007 - Failed to connect to the server.
1408     * @throws { BusinessError } 2300008 - Invalid server response.
1409     * @throws { BusinessError } 2300009 - Access to the remote resource denied.
1410     * @throws { BusinessError } 2300016 - Error in the HTTP2 framing layer.
1411     * @throws { BusinessError } 2300018 - Transferred a partial file.
1412     * @throws { BusinessError } 2300023 - Failed to write the received data to the disk or application.
1413     * @throws { BusinessError } 2300025 - Upload failed.
1414     * @throws { BusinessError } 2300026 - Failed to open or read local data from the file or application.
1415     * @throws { BusinessError } 2300027 - Out of memory.
1416     * @throws { BusinessError } 2300028 - Operation timeout.
1417     * @throws { BusinessError } 2300047 - The number of redirections reaches the maximum allowed.
1418     * @throws { BusinessError } 2300052 - The server returned nothing (no header or data).
1419     * @throws { BusinessError } 2300055 - Failed to send data to the peer.
1420     * @throws { BusinessError } 2300056 - Failed to receive data from the peer.
1421     * @throws { BusinessError } 2300058 - Local SSL certificate error.
1422     * @throws { BusinessError } 2300059 - The specified SSL cipher cannot be used.
1423     * @throws { BusinessError } 2300060 - Invalid SSL peer certificate or SSH remote key.
1424     * @throws { BusinessError } 2300061 - Invalid HTTP encoding format.
1425     * @throws { BusinessError } 2300063 - Maximum file size exceeded.
1426     * @throws { BusinessError } 2300070 - Remote disk full.
1427     * @throws { BusinessError } 2300073 - Remote file already exists.
1428     * @throws { BusinessError } 2300077 - The SSL CA certificate does not exist or is inaccessible.
1429     * @throws { BusinessError } 2300078 - Remote file not found.
1430     * @throws { BusinessError } 2300094 - Authentication error.
1431     * @throws { BusinessError } 2300998 - It is not allowed to access this domain.
1432     * @throws { BusinessError } 2300999 - Unknown error.
1433     * @syscap SystemCapability.Communication.NetStack
1434     * @atomicservice
1435     * @since 15
1436     */
1437    requestInStream(url: string, options: HttpRequestOptions, callback: AsyncCallback<number>): void;
1438
1439    /**
1440     * Initiates an HTTP request to a given URL, applicable to scenarios where http response supports streaming.
1441     * @permission ohos.permission.INTERNET
1442     * @param { string } url - URL for initiating an HTTP request.
1443     * @param { HttpRequestOptions } [options] - Optional parameters {@link HttpRequestOptions}.
1444     * @returns { Promise<number> } the promise returned by the function.
1445     * @throws { BusinessError } 401 - Parameter error.
1446     * @throws { BusinessError } 201 - Permission denied.
1447     * @throws { BusinessError } 2300001 - Unsupported protocol.
1448     * @throws { BusinessError } 2300003 - Invalid URL format or missing URL.
1449     * @throws { BusinessError } 2300005 - Failed to resolve the proxy name.
1450     * @throws { BusinessError } 2300006 - Failed to resolve the host name.
1451     * @throws { BusinessError } 2300007 - Failed to connect to the server.
1452     * @throws { BusinessError } 2300008 - Invalid server response.
1453     * @throws { BusinessError } 2300009 - Access to the remote resource denied.
1454     * @throws { BusinessError } 2300016 - Error in the HTTP2 framing layer.
1455     * @throws { BusinessError } 2300018 - Transferred a partial file.
1456     * @throws { BusinessError } 2300023 - Failed to write the received data to the disk or application.
1457     * @throws { BusinessError } 2300025 - Upload failed.
1458     * @throws { BusinessError } 2300026 - Failed to open or read local data from the file or application.
1459     * @throws { BusinessError } 2300027 - Out of memory.
1460     * @throws { BusinessError } 2300028 - Operation timeout.
1461     * @throws { BusinessError } 2300047 - The number of redirections reaches the maximum allowed.
1462     * @throws { BusinessError } 2300052 - The server returned nothing (no header or data).
1463     * @throws { BusinessError } 2300055 - Failed to send data to the peer.
1464     * @throws { BusinessError } 2300056 - Failed to receive data from the peer.
1465     * @throws { BusinessError } 2300058 - Local SSL certificate error.
1466     * @throws { BusinessError } 2300059 - The specified SSL cipher cannot be used.
1467     * @throws { BusinessError } 2300060 - Invalid SSL peer certificate or SSH remote key.
1468     * @throws { BusinessError } 2300061 - Invalid HTTP encoding format.
1469     * @throws { BusinessError } 2300063 - Maximum file size exceeded.
1470     * @throws { BusinessError } 2300070 - Remote disk full.
1471     * @throws { BusinessError } 2300073 - Remote file already exists.
1472     * @throws { BusinessError } 2300077 - The SSL CA certificate does not exist or is inaccessible.
1473     * @throws { BusinessError } 2300078 - Remote file not found.
1474     * @throws { BusinessError } 2300094 - Authentication error.
1475     * @throws { BusinessError } 2300999 - Unknown error.
1476     * @syscap SystemCapability.Communication.NetStack
1477     * @since 10
1478     */
1479    /**
1480     * Initiates an HTTP request to a given URL, applicable to scenarios where http response supports streaming.
1481     * @permission ohos.permission.INTERNET
1482     * @param { string } url - URL for initiating an HTTP request.
1483     * @param { HttpRequestOptions } [options] - Optional parameters {@link HttpRequestOptions}.
1484     * @returns { Promise<number> } the promise returned by the function.
1485     * @throws { BusinessError } 401 - Parameter error.
1486     * @throws { BusinessError } 201 - Permission denied.
1487     * @throws { BusinessError } 2300001 - Unsupported protocol.
1488     * @throws { BusinessError } 2300003 - Invalid URL format or missing URL.
1489     * @throws { BusinessError } 2300005 - Failed to resolve the proxy name.
1490     * @throws { BusinessError } 2300006 - Failed to resolve the host name.
1491     * @throws { BusinessError } 2300007 - Failed to connect to the server.
1492     * @throws { BusinessError } 2300008 - Invalid server response.
1493     * @throws { BusinessError } 2300009 - Access to the remote resource denied.
1494     * @throws { BusinessError } 2300016 - Error in the HTTP2 framing layer.
1495     * @throws { BusinessError } 2300018 - Transferred a partial file.
1496     * @throws { BusinessError } 2300023 - Failed to write the received data to the disk or application.
1497     * @throws { BusinessError } 2300025 - Upload failed.
1498     * @throws { BusinessError } 2300026 - Failed to open or read local data from the file or application.
1499     * @throws { BusinessError } 2300027 - Out of memory.
1500     * @throws { BusinessError } 2300028 - Operation timeout.
1501     * @throws { BusinessError } 2300047 - The number of redirections reaches the maximum allowed.
1502     * @throws { BusinessError } 2300052 - The server returned nothing (no header or data).
1503     * @throws { BusinessError } 2300055 - Failed to send data to the peer.
1504     * @throws { BusinessError } 2300056 - Failed to receive data from the peer.
1505     * @throws { BusinessError } 2300058 - Local SSL certificate error.
1506     * @throws { BusinessError } 2300059 - The specified SSL cipher cannot be used.
1507     * @throws { BusinessError } 2300060 - Invalid SSL peer certificate or SSH remote key.
1508     * @throws { BusinessError } 2300061 - Invalid HTTP encoding format.
1509     * @throws { BusinessError } 2300063 - Maximum file size exceeded.
1510     * @throws { BusinessError } 2300070 - Remote disk full.
1511     * @throws { BusinessError } 2300073 - Remote file already exists.
1512     * @throws { BusinessError } 2300077 - The SSL CA certificate does not exist or is inaccessible.
1513     * @throws { BusinessError } 2300078 - Remote file not found.
1514     * @throws { BusinessError } 2300094 - Authentication error.
1515     * @throws { BusinessError } 2300998 - It is not allowed to access this domain.
1516     * @throws { BusinessError } 2300999 - Unknown error.
1517     * @syscap SystemCapability.Communication.NetStack
1518     * @since 12
1519     */
1520    /**
1521     * Initiates an HTTP request to a given URL, applicable to scenarios where http response supports streaming.
1522     * @permission ohos.permission.INTERNET
1523     * @param { string } url - URL for initiating an HTTP request.
1524     * @param { HttpRequestOptions } [options] - Optional parameters {@link HttpRequestOptions}.
1525     * @returns { Promise<number> } the promise returned by the function.
1526     * @throws { BusinessError } 401 - Parameter error.
1527     * @throws { BusinessError } 201 - Permission denied.
1528     * @throws { BusinessError } 2300001 - Unsupported protocol.
1529     * @throws { BusinessError } 2300003 - Invalid URL format or missing URL.
1530     * @throws { BusinessError } 2300005 - Failed to resolve the proxy name.
1531     * @throws { BusinessError } 2300006 - Failed to resolve the host name.
1532     * @throws { BusinessError } 2300007 - Failed to connect to the server.
1533     * @throws { BusinessError } 2300008 - Invalid server response.
1534     * @throws { BusinessError } 2300009 - Access to the remote resource denied.
1535     * @throws { BusinessError } 2300016 - Error in the HTTP2 framing layer.
1536     * @throws { BusinessError } 2300018 - Transferred a partial file.
1537     * @throws { BusinessError } 2300023 - Failed to write the received data to the disk or application.
1538     * @throws { BusinessError } 2300025 - Upload failed.
1539     * @throws { BusinessError } 2300026 - Failed to open or read local data from the file or application.
1540     * @throws { BusinessError } 2300027 - Out of memory.
1541     * @throws { BusinessError } 2300028 - Operation timeout.
1542     * @throws { BusinessError } 2300047 - The number of redirections reaches the maximum allowed.
1543     * @throws { BusinessError } 2300052 - The server returned nothing (no header or data).
1544     * @throws { BusinessError } 2300055 - Failed to send data to the peer.
1545     * @throws { BusinessError } 2300056 - Failed to receive data from the peer.
1546     * @throws { BusinessError } 2300058 - Local SSL certificate error.
1547     * @throws { BusinessError } 2300059 - The specified SSL cipher cannot be used.
1548     * @throws { BusinessError } 2300060 - Invalid SSL peer certificate or SSH remote key.
1549     * @throws { BusinessError } 2300061 - Invalid HTTP encoding format.
1550     * @throws { BusinessError } 2300063 - Maximum file size exceeded.
1551     * @throws { BusinessError } 2300070 - Remote disk full.
1552     * @throws { BusinessError } 2300073 - Remote file already exists.
1553     * @throws { BusinessError } 2300077 - The SSL CA certificate does not exist or is inaccessible.
1554     * @throws { BusinessError } 2300078 - Remote file not found.
1555     * @throws { BusinessError } 2300094 - Authentication error.
1556     * @throws { BusinessError } 2300998 - It is not allowed to access this domain.
1557     * @throws { BusinessError } 2300999 - Unknown error.
1558     * @syscap SystemCapability.Communication.NetStack
1559     * @atomicservice
1560     * @since 15
1561     */
1562    requestInStream(url: string, options?: HttpRequestOptions): Promise<number>;
1563
1564    /**
1565     * Destroys an HTTP request.
1566     * @syscap SystemCapability.Communication.NetStack
1567     * @since 6
1568     */
1569    /**
1570     * Destroys an HTTP request.
1571     * @syscap SystemCapability.Communication.NetStack
1572     * @crossplatform
1573     * @since 10
1574     */
1575    /**
1576     * Destroys an HTTP request.
1577     * @syscap SystemCapability.Communication.NetStack
1578     * @crossplatform
1579     * @atomicservice
1580     * @since 11
1581     */
1582    destroy(): void;
1583
1584    /**
1585     * Registers an observer for HTTP Response Header events.
1586     * @param { "headerReceive" } type - Indicates Event name.
1587     * @param { AsyncCallback<Object> } callback - the callback used to return the result.
1588     * @syscap SystemCapability.Communication.NetStack
1589     * @since 6
1590     * @deprecated since 8
1591     * @useinstead on_headersReceive
1592     */
1593    on(type: "headerReceive", callback: AsyncCallback<Object>): void;
1594
1595    /**
1596     * Unregisters the observer for HTTP Response Header events.
1597     * @param { "headerReceive" } type - Indicates Event name.
1598     * @param { AsyncCallback<Object> } [callback] - the callback used to return the result.
1599     * @syscap SystemCapability.Communication.NetStack
1600     * @since 6
1601     * @deprecated since 8
1602     * @useinstead off_headersReceive
1603     */
1604    off(type: "headerReceive", callback?: AsyncCallback<Object>): void;
1605
1606    /**
1607     * Registers an observer for HTTP Response Header events.
1608     * @param { "headersReceive" } type - Indicates Event name.
1609     * @param { Callback<Object> } callback - the callback used to return the result.
1610     * @syscap SystemCapability.Communication.NetStack
1611     * @since 8
1612     */
1613    /**
1614     * Registers an observer for HTTP Response Header events.
1615     * @param { "headersReceive" } type - Indicates Event name.
1616     * @param { Callback<Object> } callback - the callback used to return the result.
1617     * @syscap SystemCapability.Communication.NetStack
1618     * @crossplatform
1619     * @since 10
1620     */
1621    /**
1622     * Registers an observer for HTTP Response Header events.
1623     * @param { "headersReceive" } type - Indicates Event name.
1624     * @param { Callback<Object> } callback - the callback used to return the result.
1625     * @syscap SystemCapability.Communication.NetStack
1626     * @crossplatform
1627     * @atomicservice
1628     * @since 11
1629     */
1630    on(type: "headersReceive", callback: Callback<Object>): void;
1631
1632    /**
1633     * Unregisters the observer for HTTP Response Header events.
1634     * @param { "headersReceive" } type - Indicates Event name.
1635     * @param { Callback<Object> } callback - the callback used to return the result.
1636     * @syscap SystemCapability.Communication.NetStack
1637     * @since 8
1638     */
1639    /**
1640     * Unregisters the observer for HTTP Response Header events.
1641     * @param { "headersReceive" } type - Indicates Event name.
1642     * @param { Callback<Object> } callback - the callback used to return the result.
1643     * @syscap SystemCapability.Communication.NetStack
1644     * @crossplatform
1645     * @since 10
1646     */
1647    /**
1648     * Unregisters the observer for HTTP Response Header events.
1649     * @param { "headersReceive" } type - Indicates Event name.
1650     * @param { Callback<Object> } [callback] - the callback used to return the result.
1651     * @syscap SystemCapability.Communication.NetStack
1652     * @crossplatform
1653     * @atomicservice
1654     * @since 11
1655     */
1656    off(type: "headersReceive", callback?: Callback<Object>): void;
1657
1658    /**
1659     * Registers a one-time observer for HTTP Response Header events.
1660     * @param { "headersReceive" } type - Indicates Event name.
1661     * @param { Callback<Object> } callback - the callback used to return the result.
1662     * @syscap SystemCapability.Communication.NetStack
1663     * @since 8
1664     */
1665    /**
1666     * Registers a one-time observer for HTTP Response Header events.
1667     * @param { "headersReceive" } type - Indicates Event name.
1668     * @param { Callback<Object> } callback - the callback used to return the result.
1669     * @syscap SystemCapability.Communication.NetStack
1670     * @crossplatform
1671     * @since 10
1672     */
1673    /**
1674     * Registers a one-time observer for HTTP Response Header events.
1675     * @param { "headersReceive" } type - Indicates Event name.
1676     * @param { Callback<Object> } callback - the callback used to return the result.
1677     * @syscap SystemCapability.Communication.NetStack
1678     * @crossplatform
1679     * @atomicservice
1680     * @since 15
1681     */
1682    once(type: "headersReceive", callback: Callback<Object>): void;
1683
1684    /**
1685     * Registers an observer for receiving HTTP Response data events continuously.
1686     * @param { "dataReceive" } type - Indicates Event name.
1687     * @param { Callback<ArrayBuffer> } callback - the callback used to return the result.
1688     * @syscap SystemCapability.Communication.NetStack
1689     * @since 10
1690     */
1691    /**
1692     * Registers an observer for receiving HTTP Response data events continuously.
1693     * @param { "dataReceive" } type - Indicates Event name.
1694     * @param { Callback<ArrayBuffer> } callback - the callback used to return the result.
1695     * @syscap SystemCapability.Communication.NetStack
1696     * @atomicservice
1697     * @since 15
1698     */
1699    on(type: "dataReceive", callback: Callback<ArrayBuffer>): void;
1700
1701    /**
1702     * Unregisters an observer for receiving HTTP Response data events continuously.
1703     * @param { "dataReceive" } type - Indicates Event name.
1704     * @param { Callback<ArrayBuffer> } [callback] - the callback used to return the result.
1705     * @syscap SystemCapability.Communication.NetStack
1706     * @since 10
1707     */
1708    /**
1709     * Unregisters an observer for receiving HTTP Response data events continuously.
1710     * @param { "dataReceive" } type - Indicates Event name.
1711     * @param { Callback<ArrayBuffer> } [callback] - the callback used to return the result.
1712     * @syscap SystemCapability.Communication.NetStack
1713     * @atomicservice
1714     * @since 15
1715     */
1716    off(type: "dataReceive", callback?: Callback<ArrayBuffer>): void;
1717
1718    /**
1719     * Registers an observer for receiving HTTP Response data ends events.
1720     * @param { "dataEnd" } type - Indicates Event name.
1721     * @param { Callback<void> } callback - the callback used to return the result.
1722     * @syscap SystemCapability.Communication.NetStack
1723     * @since 10
1724     */
1725    /**
1726     * Registers an observer for receiving HTTP Response data ends events.
1727     * @param { "dataEnd" } type - Indicates Event name.
1728     * @param { Callback<void> } callback - the callback used to return the result.
1729     * @syscap SystemCapability.Communication.NetStack
1730     * @atomicservice
1731     * @since 15
1732     */
1733    on(type: "dataEnd", callback: Callback<void>): void;
1734
1735    /**
1736     * Unregisters an observer for receiving HTTP Response data ends events.
1737     * @param { "dataEnd" } type - Indicates Event name.
1738     * @param { Callback<void> } [callback] - the callback used to return the result.
1739     * @syscap SystemCapability.Communication.NetStack
1740     * @since 10
1741     */
1742    /**
1743     * Unregisters an observer for receiving HTTP Response data ends events.
1744     * @param { "dataEnd" } type - Indicates Event name.
1745     * @param { Callback<void> } [callback] - the callback used to return the result.
1746     * @syscap SystemCapability.Communication.NetStack
1747     * @atomicservice
1748     * @since 15
1749     */
1750    off(type: "dataEnd", callback?: Callback<void>): void;
1751
1752    /**
1753     * Registers an observer for progress of receiving HTTP Response data events.
1754     * @param { 'dataReceiveProgress' } type - Indicates Event name.
1755     * @param { Callback<{ receiveSize: number, totalSize: number }> } callback - the callback used to return the result.
1756     * @syscap SystemCapability.Communication.NetStack
1757     * @since 10
1758     */
1759    /**
1760     * Registers an observer for progress of receiving HTTP Response data events.
1761     * @param { 'dataReceiveProgress' } type - Indicates Event name.
1762     * @param { Callback<DataReceiveProgressInfo> } callback - the callback used to return the result.
1763     * @syscap SystemCapability.Communication.NetStack
1764     * @since 11
1765     */
1766    /**
1767     * Registers an observer for progress of receiving HTTP Response data events.
1768     * @param { 'dataReceiveProgress' } type - Indicates Event name.
1769     * @param { Callback<DataReceiveProgressInfo> } callback - the callback used to return the result.
1770     * @syscap SystemCapability.Communication.NetStack
1771     * @crossplatform
1772     * @since 12
1773     */
1774    /**
1775     * Registers an observer for progress of receiving HTTP Response data events.
1776     * @param { 'dataReceiveProgress' } type - Indicates Event name.
1777     * @param { Callback<DataReceiveProgressInfo> } callback - the callback used to return the result.
1778     * @syscap SystemCapability.Communication.NetStack
1779     * @crossplatform
1780     * @atomicservice
1781     * @since 15
1782     */
1783    on(type: 'dataReceiveProgress', callback: Callback<DataReceiveProgressInfo>): void;
1784
1785    /**
1786     * Unregisters an observer for progress of receiving HTTP Response data events.
1787     * @param { 'dataReceiveProgress' } type - Indicates Event name.
1788     * @param { Callback<{ receiveSize: number, totalSize: number }> } [callback] - the callback used to return the result.
1789     * @syscap SystemCapability.Communication.NetStack
1790     * @since 10
1791     */
1792    /**
1793     * Unregisters an observer for progress of receiving HTTP Response data events.
1794     * @param { 'dataReceiveProgress' } type - Indicates Event name.
1795     * @param { Callback<DataReceiveProgressInfo> } callback - the callback used to return the result.
1796     * @syscap SystemCapability.Communication.NetStack
1797     * @since 11
1798     */
1799    /**
1800     * Unregisters an observer for progress of receiving HTTP Response data events.
1801     * @param { 'dataReceiveProgress' } type - Indicates Event name.
1802     * @param { Callback<DataReceiveProgressInfo> } callback - the callback used to return the result.
1803     * @syscap SystemCapability.Communication.NetStack
1804     * @crossplatform
1805     * @since 12
1806     */
1807    /**
1808     * Unregisters an observer for progress of receiving HTTP Response data events.
1809     * @param { 'dataReceiveProgress' } type - Indicates Event name.
1810     * @param { Callback<DataReceiveProgressInfo> } callback - the callback used to return the result.
1811     * @syscap SystemCapability.Communication.NetStack
1812     * @crossplatform
1813     * @atomicservice
1814     * @since 15
1815     */
1816    off(type: 'dataReceiveProgress', callback?: Callback<DataReceiveProgressInfo>): void;
1817
1818    /**
1819     * Registers an observer for progress of sendSize HTTP Response data events.
1820     * @param { 'dataSendProgress' } type - Indicates Event name.
1821     * @param { Callback<DataSendProgressInfo> } callback - the callback of on.
1822     * @syscap SystemCapability.Communication.NetStack
1823     * @since 11
1824     */
1825    /**
1826     * Registers an observer for progress of sendSize HTTP Response data events.
1827     * @param { 'dataSendProgress' } type - Indicates Event name.
1828     * @param { Callback<DataSendProgressInfo> } callback - the callback of on.
1829     * @syscap SystemCapability.Communication.NetStack
1830     * @crossplatform
1831     * @since 12
1832     */
1833    /**
1834     * Registers an observer for progress of sendSize HTTP Response data events.
1835     * @param { 'dataSendProgress' } type - Indicates Event name.
1836     * @param { Callback<DataSendProgressInfo> } callback - the callback of on.
1837     * @syscap SystemCapability.Communication.NetStack
1838     * @crossplatform
1839     * @atomicservice
1840     * @since 15
1841     */
1842    on(type: 'dataSendProgress', callback: Callback<DataSendProgressInfo>): void
1843
1844    /**
1845     * Unregisters an observer for progress of sendSize HTTP Response data events.
1846     * @param { 'dataSendProgress' } type - Indicates Event name.
1847     * @param { Callback<DataSendProgressInfo> } [callback] - the callback of off.
1848     * @syscap SystemCapability.Communication.NetStack
1849     * @since 11
1850     */
1851    /**
1852     * Unregisters an observer for progress of sendSize HTTP Response data events.
1853     * @param { 'dataSendProgress' } type - Indicates Event name.
1854     * @param { Callback<DataSendProgressInfo> } [callback] - the callback of off.
1855     * @syscap SystemCapability.Communication.NetStack
1856     * @crossplatform
1857     * @since 12
1858     */
1859    /**
1860     * Unregisters an observer for progress of sendSize HTTP Response data events.
1861     * @param { 'dataSendProgress' } type - Indicates Event name.
1862     * @param { Callback<DataSendProgressInfo> } [callback] - the callback of off.
1863     * @syscap SystemCapability.Communication.NetStack
1864     * @crossplatform
1865     * @atomicservice
1866     * @since 15
1867     */
1868    off(type: 'dataSendProgress', callback?: Callback<DataSendProgressInfo>): void
1869  }
1870
1871  /**
1872   * Defines an HTTP request method.
1873   * @enum {string}
1874   * @syscap SystemCapability.Communication.NetStack
1875   * @since 6
1876   */
1877  /**
1878   * Defines an HTTP request method.
1879   * @enum {string}
1880   * @syscap SystemCapability.Communication.NetStack
1881   * @crossplatform
1882   * @since 10
1883   */
1884  /**
1885   * Defines an HTTP request method.
1886   * @enum {string}
1887   * @syscap SystemCapability.Communication.NetStack
1888   * @crossplatform
1889   * @atomicservice
1890   * @since 11
1891   */
1892  export enum RequestMethod {
1893    /**
1894     * OPTIONS method.
1895     * @syscap SystemCapability.Communication.NetStack
1896     * @since 6
1897     */
1898    /**
1899     * OPTIONS method.
1900     * @syscap SystemCapability.Communication.NetStack
1901     * @crossplatform
1902     * @since 10
1903     */
1904    /**
1905     * OPTIONS method.
1906     * @syscap SystemCapability.Communication.NetStack
1907     * @crossplatform
1908     * @atomicservice
1909     * @since 11
1910     */
1911    OPTIONS = "OPTIONS",
1912
1913    /**
1914     * GET method.
1915     * @syscap SystemCapability.Communication.NetStack
1916     * @since 6
1917     */
1918    /**
1919     * GET method.
1920     * @syscap SystemCapability.Communication.NetStack
1921     * @crossplatform
1922     * @since 10
1923     */
1924    /**
1925     * GET method.
1926     * @syscap SystemCapability.Communication.NetStack
1927     * @crossplatform
1928     * @atomicservice
1929     * @since 11
1930     */
1931    GET = "GET",
1932
1933    /**
1934     * HEAD method.
1935     * @syscap SystemCapability.Communication.NetStack
1936     * @since 6
1937     */
1938    /**
1939     * HEAD method.
1940     * @syscap SystemCapability.Communication.NetStack
1941     * @crossplatform
1942     * @since 10
1943     */
1944    /**
1945     * HEAD method.
1946     * @syscap SystemCapability.Communication.NetStack
1947     * @crossplatform
1948     * @atomicservice
1949     * @since 11
1950     */
1951    HEAD = "HEAD",
1952
1953    /**
1954     * POST method.
1955     * @syscap SystemCapability.Communication.NetStack
1956     * @since 6
1957     */
1958    /**
1959     * POST method.
1960     * @syscap SystemCapability.Communication.NetStack
1961     * @crossplatform
1962     * @since 10
1963     */
1964    /**
1965     * POST method.
1966     * @syscap SystemCapability.Communication.NetStack
1967     * @crossplatform
1968     * @atomicservice
1969     * @since 11
1970     */
1971    POST = "POST",
1972
1973    /**
1974     * PUT method.
1975     * @syscap SystemCapability.Communication.NetStack
1976     * @since 6
1977     */
1978    /**
1979     * PUT method.
1980     * @syscap SystemCapability.Communication.NetStack
1981     * @crossplatform
1982     * @since 10
1983     */
1984    /**
1985     * PUT method.
1986     * @syscap SystemCapability.Communication.NetStack
1987     * @crossplatform
1988     * @atomicservice
1989     * @since 11
1990     */
1991    PUT = "PUT",
1992
1993    /**
1994     * DELETE method.
1995     * @syscap SystemCapability.Communication.NetStack
1996     * @since 6
1997     */
1998    /**
1999     * DELETE method.
2000     * @syscap SystemCapability.Communication.NetStack
2001     * @crossplatform
2002     * @since 10
2003     */
2004    /**
2005     * DELETE method.
2006     * @syscap SystemCapability.Communication.NetStack
2007     * @crossplatform
2008     * @atomicservice
2009     * @since 11
2010     */
2011    DELETE = "DELETE",
2012
2013    /**
2014     * TRACE method.
2015     * @syscap SystemCapability.Communication.NetStack
2016     * @since 6
2017     */
2018    /**
2019     * TRACE method.
2020     * @syscap SystemCapability.Communication.NetStack
2021     * @crossplatform
2022     * @since 10
2023     */
2024    /**
2025     * TRACE method.
2026     * @syscap SystemCapability.Communication.NetStack
2027     * @crossplatform
2028     * @atomicservice
2029     * @since 11
2030     */
2031    TRACE = "TRACE",
2032
2033    /**
2034     * CONNECT method.
2035     * @syscap SystemCapability.Communication.NetStack
2036     * @since 6
2037     */
2038    /**
2039     * CONNECT method.
2040     * @syscap SystemCapability.Communication.NetStack
2041     * @crossplatform
2042     * @since 10
2043     */
2044    /**
2045     * CONNECT method.
2046     * @syscap SystemCapability.Communication.NetStack
2047     * @crossplatform
2048     * @atomicservice
2049     * @since 11
2050     */
2051    CONNECT = "CONNECT"
2052  }
2053
2054  /**
2055   * Enumerates the response codes for an HTTP request.
2056   * @enum {number}
2057   * @syscap SystemCapability.Communication.NetStack
2058   * @since 6
2059   */
2060  /**
2061   * Enumerates the response codes for an HTTP request.
2062   * @enum {number}
2063   * @syscap SystemCapability.Communication.NetStack
2064   * @crossplatform
2065   * @since 10
2066   */
2067  /**
2068   * Enumerates the response codes for an HTTP request.
2069   * @enum {number}
2070   * @syscap SystemCapability.Communication.NetStack
2071   * @crossplatform
2072   * @atomicservice
2073   * @since 11
2074   */
2075  export enum ResponseCode {
2076    /**
2077     * The request was successful. Typically used for GET and POST requests.
2078     * @syscap SystemCapability.Communication.NetStack
2079     * @since 6
2080     */
2081    /**
2082     * The request was successful. Typically used for GET and POST requests.
2083     * @syscap SystemCapability.Communication.NetStack
2084     * @crossplatform
2085     * @since 10
2086     */
2087    /**
2088     * The request was successful. Typically used for GET and POST requests.
2089     * @syscap SystemCapability.Communication.NetStack
2090     * @crossplatform
2091     * @atomicservice
2092     * @since 11
2093     */
2094    OK = 200,
2095
2096    /**
2097     * Successfully requested and created a new resource.
2098     * @syscap SystemCapability.Communication.NetStack
2099     * @since 6
2100     */
2101    /**
2102     * Successfully requested and created a new resource.
2103     * @syscap SystemCapability.Communication.NetStack
2104     * @crossplatform
2105     * @since 10
2106     */
2107    /**
2108     * Successfully requested and created a new resource.
2109     * @syscap SystemCapability.Communication.NetStack
2110     * @crossplatform
2111     * @atomicservice
2112     * @since 11
2113     */
2114    CREATED,
2115
2116    /**
2117     * The request has been accepted but has not been processed completely.
2118     * @syscap SystemCapability.Communication.NetStack
2119     * @since 6
2120     */
2121    /**
2122     * The request has been accepted but has not been processed completely.
2123     * @syscap SystemCapability.Communication.NetStack
2124     * @crossplatform
2125     * @since 10
2126     */
2127    /**
2128     * The request has been accepted but has not been processed completely.
2129     * @syscap SystemCapability.Communication.NetStack
2130     * @crossplatform
2131     * @atomicservice
2132     * @since 11
2133     */
2134    ACCEPTED,
2135
2136    /**
2137     * Unauthorized information. The request was successful.
2138     * @syscap SystemCapability.Communication.NetStack
2139     * @since 6
2140     */
2141    /**
2142     * Unauthorized information. The request was successful.
2143     * @syscap SystemCapability.Communication.NetStack
2144     * @crossplatform
2145     * @since 10
2146     */
2147    /**
2148     * Unauthorized information. The request was successful.
2149     * @syscap SystemCapability.Communication.NetStack
2150     * @crossplatform
2151     * @atomicservice
2152     * @since 11
2153     */
2154    NOT_AUTHORITATIVE,
2155
2156    /**
2157     * No content. The server successfully processed, but did not return content.
2158     * @syscap SystemCapability.Communication.NetStack
2159     * @since 6
2160     */
2161    /**
2162     * No content. The server successfully processed, but did not return content.
2163     * @syscap SystemCapability.Communication.NetStack
2164     * @crossplatform
2165     * @since 10
2166     */
2167    /**
2168     * No content. The server successfully processed, but did not return content.
2169     * @syscap SystemCapability.Communication.NetStack
2170     * @crossplatform
2171     * @atomicservice
2172     * @since 11
2173     */
2174    NO_CONTENT,
2175
2176    /**
2177     * Reset the content.
2178     * @syscap SystemCapability.Communication.NetStack
2179     * @since 6
2180     */
2181    /**
2182     * Reset the content.
2183     * @syscap SystemCapability.Communication.NetStack
2184     * @crossplatform
2185     * @since 10
2186     */
2187    /**
2188     * Reset the content.
2189     * @syscap SystemCapability.Communication.NetStack
2190     * @crossplatform
2191     * @atomicservice
2192     * @since 11
2193     */
2194    RESET,
2195
2196    /**
2197     * Partial content. The server successfully processed some GET requests.
2198     * @syscap SystemCapability.Communication.NetStack
2199     * @since 6
2200     */
2201    /**
2202     * Partial content. The server successfully processed some GET requests.
2203     * @syscap SystemCapability.Communication.NetStack
2204     * @crossplatform
2205     * @since 10
2206     */
2207    /**
2208     * Partial content. The server successfully processed some GET requests.
2209     * @syscap SystemCapability.Communication.NetStack
2210     * @crossplatform
2211     * @atomicservice
2212     * @since 11
2213     */
2214    PARTIAL,
2215
2216    /**
2217     * Multiple options.
2218     * @syscap SystemCapability.Communication.NetStack
2219     * @since 6
2220     */
2221    /**
2222     * Multiple options.
2223     * @syscap SystemCapability.Communication.NetStack
2224     * @crossplatform
2225     * @since 10
2226     */
2227    /**
2228     * Multiple options.
2229     * @syscap SystemCapability.Communication.NetStack
2230     * @crossplatform
2231     * @atomicservice
2232     * @since 11
2233     */
2234    MULT_CHOICE = 300,
2235
2236    /**
2237     * <p>Permanently move. The requested resource has been permanently moved to a new URI,
2238     * and the returned information will include the new URI. The browser will automatically redirect to the new URI.</p>
2239     * @syscap SystemCapability.Communication.NetStack
2240     * @since 6
2241     */
2242    /**
2243     * <p>Permanently move. The requested resource has been permanently moved to a new URI,
2244     * and the returned information will include the new URI. The browser will automatically redirect to the new URI.</p>
2245     * @syscap SystemCapability.Communication.NetStack
2246     * @crossplatform
2247     * @since 10
2248     */
2249    /**
2250     * <p>Permanently move. The requested resource has been permanently moved to a new URI,
2251     * and the returned information will include the new URI. The browser will automatically redirect to the new URI.</p>
2252     * @syscap SystemCapability.Communication.NetStack
2253     * @crossplatform
2254     * @atomicservice
2255     * @since 11
2256     */
2257    MOVED_PERM,
2258
2259    /**
2260     * Temporary movement.
2261     * @syscap SystemCapability.Communication.NetStack
2262     * @since 6
2263     */
2264    /**
2265     * Temporary movement.
2266     * @syscap SystemCapability.Communication.NetStack
2267     * @crossplatform
2268     * @since 10
2269     */
2270    /**
2271     * Temporary movement.
2272     * @syscap SystemCapability.Communication.NetStack
2273     * @crossplatform
2274     * @atomicservice
2275     * @since 11
2276     */
2277    MOVED_TEMP,
2278
2279    /**
2280     * View other addresses.
2281     * @syscap SystemCapability.Communication.NetStack
2282     * @since 6
2283     */
2284    /**
2285     * View other addresses.
2286     * @syscap SystemCapability.Communication.NetStack
2287     * @crossplatform
2288     * @since 10
2289     */
2290    /**
2291     * View other addresses.
2292     * @syscap SystemCapability.Communication.NetStack
2293     * @crossplatform
2294     * @atomicservice
2295     * @since 11
2296     */
2297    SEE_OTHER,
2298
2299    /**
2300     * Not modified.
2301     * @syscap SystemCapability.Communication.NetStack
2302     * @since 6
2303     */
2304    /**
2305     * Not modified.
2306     * @syscap SystemCapability.Communication.NetStack
2307     * @crossplatform
2308     * @since 10
2309     */
2310    /**
2311     * Not modified.
2312     * @syscap SystemCapability.Communication.NetStack
2313     * @crossplatform
2314     * @atomicservice
2315     * @since 11
2316     */
2317    NOT_MODIFIED,
2318
2319    /**
2320     * Using proxies.
2321     * @syscap SystemCapability.Communication.NetStack
2322     * @since 6
2323     */
2324    /**
2325     * Using proxies.
2326     * @syscap SystemCapability.Communication.NetStack
2327     * @crossplatform
2328     * @since 10
2329     */
2330    /**
2331     * Using proxies.
2332     * @syscap SystemCapability.Communication.NetStack
2333     * @crossplatform
2334     * @atomicservice
2335     * @since 11
2336     */
2337    USE_PROXY,
2338
2339    /**
2340     * The server cannot understand the syntax error error requested by the client.
2341     * @syscap SystemCapability.Communication.NetStack
2342     * @since 6
2343     */
2344    /**
2345     * The server cannot understand the syntax error error requested by the client.
2346     * @syscap SystemCapability.Communication.NetStack
2347     * @crossplatform
2348     * @since 10
2349     */
2350    /**
2351     * The server cannot understand the syntax error error requested by the client.
2352     * @syscap SystemCapability.Communication.NetStack
2353     * @crossplatform
2354     * @atomicservice
2355     * @since 11
2356     */
2357    BAD_REQUEST = 400,
2358
2359    /**
2360     * Request for user authentication.
2361     * @syscap SystemCapability.Communication.NetStack
2362     * @since 6
2363     */
2364    /**
2365     * Request for user authentication.
2366     * @syscap SystemCapability.Communication.NetStack
2367     * @crossplatform
2368     * @since 10
2369     */
2370    /**
2371     * Request for user authentication.
2372     * @syscap SystemCapability.Communication.NetStack
2373     * @crossplatform
2374     * @atomicservice
2375     * @since 11
2376     */
2377    UNAUTHORIZED,
2378
2379    /**
2380     * Reserved for future use.
2381     * @syscap SystemCapability.Communication.NetStack
2382     * @since 6
2383     */
2384    /**
2385     * Reserved for future use.
2386     * @syscap SystemCapability.Communication.NetStack
2387     * @crossplatform
2388     * @since 10
2389     */
2390    /**
2391     * Reserved for future use.
2392     * @syscap SystemCapability.Communication.NetStack
2393     * @crossplatform
2394     * @atomicservice
2395     * @since 11
2396     */
2397    PAYMENT_REQUIRED,
2398
2399    /**
2400     * The server understands the request from the requesting client, but refuses to execute it.
2401     * @syscap SystemCapability.Communication.NetStack
2402     * @since 6
2403     */
2404    /**
2405     * The server understands the request from the requesting client, but refuses to execute it.
2406     * @syscap SystemCapability.Communication.NetStack
2407     * @crossplatform
2408     * @since 10
2409     */
2410    /**
2411     * The server understands the request from the requesting client, but refuses to execute it.
2412     * @syscap SystemCapability.Communication.NetStack
2413     * @crossplatform
2414     * @atomicservice
2415     * @since 11
2416     */
2417    FORBIDDEN,
2418
2419    /**
2420     * The server was unable to find resources (web pages) based on the client's request.
2421     * @syscap SystemCapability.Communication.NetStack
2422     * @since 6
2423     */
2424    /**
2425     * The server was unable to find resources (web pages) based on the client's request.
2426     * @syscap SystemCapability.Communication.NetStack
2427     * @crossplatform
2428     * @since 10
2429     */
2430    /**
2431     * The server was unable to find resources (web pages) based on the client's request.
2432     * @syscap SystemCapability.Communication.NetStack
2433     * @crossplatform
2434     * @atomicservice
2435     * @since 11
2436     */
2437    NOT_FOUND,
2438
2439    /**
2440     * The method in the client request is prohibited.
2441     * @syscap SystemCapability.Communication.NetStack
2442     * @since 6
2443     */
2444    /**
2445     * The method in the client request is prohibited.
2446     * @syscap SystemCapability.Communication.NetStack
2447     * @crossplatform
2448     * @since 10
2449     */
2450    /**
2451     * The method in the client request is prohibited.
2452     * @syscap SystemCapability.Communication.NetStack
2453     * @crossplatform
2454     * @atomicservice
2455     * @since 11
2456     */
2457    BAD_METHOD,
2458
2459    /**
2460     * The server is unable to complete the request based on the content characteristics requested by the client.
2461     * @syscap SystemCapability.Communication.NetStack
2462     * @since 6
2463     */
2464    /**
2465     * The server is unable to complete the request based on the content characteristics requested by the client.
2466     * @syscap SystemCapability.Communication.NetStack
2467     * @crossplatform
2468     * @since 10
2469     */
2470    /**
2471     * The server is unable to complete the request based on the content characteristics requested by the client.
2472     * @syscap SystemCapability.Communication.NetStack
2473     * @crossplatform
2474     * @atomicservice
2475     * @since 11
2476     */
2477    NOT_ACCEPTABLE,
2478
2479    /**
2480     * Request authentication of the proxy's identity.
2481     * @syscap SystemCapability.Communication.NetStack
2482     * @since 6
2483     */
2484    /**
2485     * Request authentication of the proxy's identity.
2486     * @syscap SystemCapability.Communication.NetStack
2487     * @crossplatform
2488     * @since 10
2489     */
2490    /**
2491     * Request authentication of the proxy's identity.
2492     * @syscap SystemCapability.Communication.NetStack
2493     * @crossplatform
2494     * @atomicservice
2495     * @since 11
2496     */
2497    PROXY_AUTH,
2498
2499    /**
2500     * The request took too long and timed out.
2501     * @syscap SystemCapability.Communication.NetStack
2502     * @since 6
2503     */
2504    /**
2505     * The request took too long and timed out.
2506     * @syscap SystemCapability.Communication.NetStack
2507     * @crossplatform
2508     * @since 10
2509     */
2510    /**
2511     * The request took too long and timed out.
2512     * @syscap SystemCapability.Communication.NetStack
2513     * @crossplatform
2514     * @atomicservice
2515     * @since 11
2516     */
2517    CLIENT_TIMEOUT,
2518
2519    /**
2520     * <p>The server may have returned this code when completing the client's PUT request,
2521     * as there was a conflict when the server was processing the request.</p>
2522     * @syscap SystemCapability.Communication.NetStack
2523     * @since 6
2524     */
2525    /**
2526     * <p>The server may have returned this code when completing the client's PUT request,
2527     * as there was a conflict when the server was processing the request.</p>
2528     * @syscap SystemCapability.Communication.NetStack
2529     * @crossplatform
2530     * @since 10
2531     */
2532    /**
2533     * <p>The server may have returned this code when completing the client's PUT request,
2534     * as there was a conflict when the server was processing the request.</p>
2535     * @syscap SystemCapability.Communication.NetStack
2536     * @crossplatform
2537     * @atomicservice
2538     * @since 11
2539     */
2540    CONFLICT,
2541
2542    /**
2543     * The resource requested by the client no longer exists.
2544     * @syscap SystemCapability.Communication.NetStack
2545     * @since 6
2546     */
2547    /**
2548     * The resource requested by the client no longer exists.
2549     * @syscap SystemCapability.Communication.NetStack
2550     * @crossplatform
2551     * @since 10
2552     */
2553    /**
2554     * The resource requested by the client no longer exists.
2555     * @syscap SystemCapability.Communication.NetStack
2556     * @crossplatform
2557     * @atomicservice
2558     * @since 11
2559     */
2560    GONE,
2561
2562    /**
2563     * The server is unable to process request information sent by the client without Content Length.
2564     * @syscap SystemCapability.Communication.NetStack
2565     * @since 6
2566     */
2567    /**
2568     * The server is unable to process request information sent by the client without Content Length.
2569     * @syscap SystemCapability.Communication.NetStack
2570     * @crossplatform
2571     * @since 10
2572     */
2573    /**
2574     * The server is unable to process request information sent by the client without Content Length.
2575     * @syscap SystemCapability.Communication.NetStack
2576     * @crossplatform
2577     * @atomicservice
2578     * @since 11
2579     */
2580    LENGTH_REQUIRED,
2581
2582    /**
2583     * The prerequisite for requesting information from the client is incorrect.
2584     * @syscap SystemCapability.Communication.NetStack
2585     * @since 6
2586     */
2587    /**
2588     * The prerequisite for requesting information from the client is incorrect.
2589     * @syscap SystemCapability.Communication.NetStack
2590     * @crossplatform
2591     * @since 10
2592     */
2593    /**
2594     * The prerequisite for requesting information from the client is incorrect.
2595     * @syscap SystemCapability.Communication.NetStack
2596     * @crossplatform
2597     * @atomicservice
2598     * @since 11
2599     */
2600    PRECON_FAILED,
2601
2602    /**
2603     * The request was rejected because the requested entity was too large for the server to process.
2604     * @syscap SystemCapability.Communication.NetStack
2605     * @since 6
2606     */
2607    /**
2608     * The request was rejected because the requested entity was too large for the server to process.
2609     * @syscap SystemCapability.Communication.NetStack
2610     * @crossplatform
2611     * @since 10
2612     */
2613    /**
2614     * The request was rejected because the requested entity was too large for the server to process.
2615     * @syscap SystemCapability.Communication.NetStack
2616     * @crossplatform
2617     * @atomicservice
2618     * @since 11
2619     */
2620    ENTITY_TOO_LARGE,
2621
2622    /**
2623     * The requested URI is too long (usually a URL) and the server cannot process it.
2624     * @syscap SystemCapability.Communication.NetStack
2625     * @since 6
2626     */
2627    /**
2628     * The requested URI is too long (usually a URL) and the server cannot process it.
2629     * @syscap SystemCapability.Communication.NetStack
2630     * @crossplatform
2631     * @since 10
2632     */
2633    /**
2634     * The requested URI is too long (usually a URL) and the server cannot process it.
2635     * @syscap SystemCapability.Communication.NetStack
2636     * @crossplatform
2637     * @atomicservice
2638     * @since 11
2639     */
2640    REQ_TOO_LONG,
2641
2642    /**
2643     * The server is unable to process the requested format.
2644     * @syscap SystemCapability.Communication.NetStack
2645     * @since 6
2646     */
2647    /**
2648     * The server is unable to process the requested format.
2649     * @syscap SystemCapability.Communication.NetStack
2650     * @crossplatform
2651     * @since 10
2652     */
2653    /**
2654     * The server is unable to process the requested format.
2655     * @syscap SystemCapability.Communication.NetStack
2656     * @crossplatform
2657     * @atomicservice
2658     * @since 11
2659     */
2660    UNSUPPORTED_TYPE,
2661
2662    /**
2663     * The server cannot process the requested data range.
2664     * @syscap SystemCapability.Communication.NetStack
2665     * @crossplatform
2666     * @atomicservice
2667     * @since 12
2668     */
2669    RANGE_NOT_SATISFIABLE,
2670
2671    /**
2672     * Internal server error, unable to complete the request.
2673     * @syscap SystemCapability.Communication.NetStack
2674     * @since 6
2675     */
2676    /**
2677     * Internal server error, unable to complete the request.
2678     * @syscap SystemCapability.Communication.NetStack
2679     * @crossplatform
2680     * @since 10
2681     */
2682    /**
2683     * Internal server error, unable to complete the request.
2684     * @syscap SystemCapability.Communication.NetStack
2685     * @crossplatform
2686     * @atomicservice
2687     * @since 11
2688     */
2689    INTERNAL_ERROR = 500,
2690
2691    /**
2692     * The server does not support the requested functionality and cannot complete the request.
2693     * @syscap SystemCapability.Communication.NetStack
2694     * @since 6
2695     */
2696    /**
2697     * The server does not support the requested functionality and cannot complete the request.
2698     * @syscap SystemCapability.Communication.NetStack
2699     * @crossplatform
2700     * @since 10
2701     */
2702    /**
2703     * The server does not support the requested functionality and cannot complete the request.
2704     * @syscap SystemCapability.Communication.NetStack
2705     * @crossplatform
2706     * @atomicservice
2707     * @since 11
2708     */
2709    NOT_IMPLEMENTED,
2710
2711    /**
2712     * The server acting as a gateway or proxy received an invalid request from the remote server.
2713     * @syscap SystemCapability.Communication.NetStack
2714     * @since 6
2715     */
2716    /**
2717     * The server acting as a gateway or proxy received an invalid request from the remote server.
2718     * @syscap SystemCapability.Communication.NetStack
2719     * @crossplatform
2720     * @since 10
2721     */
2722    /**
2723     * The server acting as a gateway or proxy received an invalid request from the remote server.
2724     * @syscap SystemCapability.Communication.NetStack
2725     * @crossplatform
2726     * @atomicservice
2727     * @since 11
2728     */
2729    BAD_GATEWAY,
2730
2731    /**
2732     * Due to overload or system maintenance, the server is temporarily unable to process client requests.
2733     * @syscap SystemCapability.Communication.NetStack
2734     * @since 6
2735     */
2736    /**
2737     * Due to overload or system maintenance, the server is temporarily unable to process client requests.
2738     * @syscap SystemCapability.Communication.NetStack
2739     * @crossplatform
2740     * @since 10
2741     */
2742    /**
2743     * Due to overload or system maintenance, the server is temporarily unable to process client requests.
2744     * @syscap SystemCapability.Communication.NetStack
2745     * @crossplatform
2746     * @atomicservice
2747     * @since 11
2748     */
2749    UNAVAILABLE,
2750
2751    /**
2752     * The server acting as a gateway or proxy did not obtain requests from the remote server in a timely manner.
2753     * @syscap SystemCapability.Communication.NetStack
2754     * @since 6
2755     */
2756    /**
2757     * The server acting as a gateway or proxy did not obtain requests from the remote server in a timely manner.
2758     * @syscap SystemCapability.Communication.NetStack
2759     * @crossplatform
2760     * @since 10
2761     */
2762    /**
2763     * The server acting as a gateway or proxy did not obtain requests from the remote server in a timely manner.
2764     * @syscap SystemCapability.Communication.NetStack
2765     * @crossplatform
2766     * @atomicservice
2767     * @since 11
2768     */
2769    GATEWAY_TIMEOUT,
2770
2771    /**
2772     * The version of the HTTP protocol requested by the server.
2773     * @syscap SystemCapability.Communication.NetStack
2774     * @since 6
2775     */
2776    /**
2777     * The version of the HTTP protocol requested by the server.
2778     * @syscap SystemCapability.Communication.NetStack
2779     * @crossplatform
2780     * @since 10
2781     */
2782    /**
2783     * The version of the HTTP protocol requested by the server.
2784     * @syscap SystemCapability.Communication.NetStack
2785     * @crossplatform
2786     * @atomicservice
2787     * @since 11
2788     */
2789    VERSION
2790  }
2791
2792  /**
2793   * Supported protocols.
2794   * @enum {string}
2795   * @syscap SystemCapability.Communication.NetStack
2796   * @since 9
2797   */
2798  /**
2799   * Supported protocols.
2800   * @enum {string}
2801   * @syscap SystemCapability.Communication.NetStack
2802   * @crossplatform
2803   * @since 10
2804   */
2805  /**
2806   * Supported protocols.
2807   * @enum {string}
2808   * @syscap SystemCapability.Communication.NetStack
2809   * @crossplatform
2810   * @atomicservice
2811   * @since 11
2812   */
2813
2814  export enum HttpProtocol {
2815    /**
2816     * Protocol http1.1
2817     * @syscap SystemCapability.Communication.NetStack
2818     * @since 9
2819     */
2820    /**
2821     * Protocol http1.1
2822     * @syscap SystemCapability.Communication.NetStack
2823     * @crossplatform
2824     * @since 10
2825     */
2826    /**
2827     * Protocol http1.1
2828     * @syscap SystemCapability.Communication.NetStack
2829     * @crossplatform
2830     * @atomicservice
2831     * @since 11
2832     */
2833    HTTP1_1,
2834
2835    /**
2836     * Protocol http2
2837     * @syscap SystemCapability.Communication.NetStack
2838     * @since 9
2839     */
2840    /**
2841     * Protocol http2
2842     * @syscap SystemCapability.Communication.NetStack
2843     * @crossplatform
2844     * @since 10
2845     */
2846    /**
2847     * Protocol http2
2848     * @syscap SystemCapability.Communication.NetStack
2849     * @crossplatform
2850     * @atomicservice
2851     * @since 11
2852     */
2853    HTTP2,
2854
2855    /**
2856     * Protocol http3 for https only.
2857     * Cause error if using http only or not supporting http3 on this device.
2858     * Fallback to http2 or http1.1 if needed.
2859     * @syscap SystemCapability.Communication.NetStack
2860     * @since 11
2861     */
2862    /**
2863     * Protocol http3 for https only.
2864     * Cause error if using http only or not supporting http3 on this device.
2865     * Fallback to http2 or http1.1 if needed.
2866     * @syscap SystemCapability.Communication.NetStack
2867     * @crossplatform
2868     * @since 12
2869     */
2870    HTTP3
2871  }
2872
2873  /**
2874   * Indicates the type of the returned data.
2875   * @enum {number}
2876   * @syscap SystemCapability.Communication.NetStack
2877   * @since 9
2878   */
2879  /**
2880   * Indicates the type of the returned data.
2881   * @enum {number}
2882   * @syscap SystemCapability.Communication.NetStack
2883   * @crossplatform
2884   * @since 10
2885   */
2886  /**
2887   * Indicates the type of the returned data.
2888   * @enum {number}
2889   * @syscap SystemCapability.Communication.NetStack
2890   * @crossplatform
2891   * @atomicservice
2892   * @since 11
2893   */
2894  export enum HttpDataType {
2895    /**
2896     * The returned type is string.
2897     * @syscap SystemCapability.Communication.NetStack
2898     * @since 9
2899     */
2900    /**
2901     * The returned type is string.
2902     * @syscap SystemCapability.Communication.NetStack
2903     * @crossplatform
2904     * @since 10
2905     */
2906    /**
2907     * The returned type is string.
2908     * @syscap SystemCapability.Communication.NetStack
2909     * @crossplatform
2910     * @atomicservice
2911     * @since 11
2912     */
2913    STRING,
2914
2915    /**
2916     * The returned type is Object.
2917     * @syscap SystemCapability.Communication.NetStack
2918     * @since 9
2919     */
2920    /**
2921     * The returned type is Object.
2922     * @syscap SystemCapability.Communication.NetStack
2923     * @crossplatform
2924     * @since 10
2925     */
2926    /**
2927     * The returned type is Object.
2928     * @syscap SystemCapability.Communication.NetStack
2929     * @crossplatform
2930     * @atomicservice
2931     * @since 11
2932     */
2933    OBJECT = 1,
2934
2935    /**
2936     * The returned type is ArrayBuffer.
2937     * @syscap SystemCapability.Communication.NetStack
2938     * @since 9
2939     */
2940    /**
2941     * The returned type is ArrayBuffer.
2942     * @syscap SystemCapability.Communication.NetStack
2943     * @crossplatform
2944     * @since 10
2945     */
2946    /**
2947     * The returned type is ArrayBuffer.
2948     * @syscap SystemCapability.Communication.NetStack
2949     * @crossplatform
2950     * @atomicservice
2951     * @since 11
2952     */
2953    ARRAY_BUFFER = 2
2954  }
2955
2956  /**
2957   * Defines the response to an HTTP request.
2958   * @interface HttpResponse
2959   * @syscap SystemCapability.Communication.NetStack
2960   * @since 6
2961   */
2962  /**
2963   * Defines the response to an HTTP request.
2964   * @interface HttpResponse
2965   * @syscap SystemCapability.Communication.NetStack
2966   * @crossplatform
2967   * @since 10
2968   */
2969  /**
2970   * Defines the response to an HTTP request.
2971   * @interface HttpResponse
2972   * @syscap SystemCapability.Communication.NetStack
2973   * @crossplatform
2974   * @atomicservice
2975   * @since 11
2976   */
2977  export interface HttpResponse {
2978    /**
2979     * result can be a string (API 6) or an ArrayBuffer(API 8). Object is deprecated from API 8.
2980     * If {@link HttpRequestOptions#expectDataType} is set, the system preferentially returns this parameter.
2981     * @type {string | Object | ArrayBuffer}
2982     * @syscap SystemCapability.Communication.NetStack
2983     * @since 6
2984     */
2985    /**
2986     * result can be a string (API 6) or an ArrayBuffer(API 8). Object is deprecated from API 8.
2987     * If {@link HttpRequestOptions#expectDataType} is set, the system preferentially returns this parameter.
2988     * @type {string | Object | ArrayBuffer}
2989     * @syscap SystemCapability.Communication.NetStack
2990     * @crossplatform
2991     * @since 10
2992     */
2993    /**
2994     * result can be a string (API 6) or an ArrayBuffer(API 8). Object is deprecated from API 8.
2995     * If {@link HttpRequestOptions#expectDataType} is set, the system preferentially returns this parameter.
2996     * @type {string | Object | ArrayBuffer}
2997     * @syscap SystemCapability.Communication.NetStack
2998     * @crossplatform
2999     * @atomicservice
3000     * @since 11
3001     */
3002    result: string | Object | ArrayBuffer;
3003
3004    /**
3005     * If the resultType is string, you can get result directly.
3006     * If the resultType is Object, you can get result such as this: result['key'].
3007     * If the resultType is ArrayBuffer, you can use ArrayBuffer to create the binary objects.
3008     * @type {HttpDataType}
3009     * @syscap SystemCapability.Communication.NetStack
3010     * @since 9
3011     */
3012    /**
3013     * If the resultType is string, you can get result directly.
3014     * If the resultType is Object, you can get result such as this: result['key'].
3015     * If the resultType is ArrayBuffer, you can use ArrayBuffer to create the binary objects.
3016     * @type {HttpDataType}
3017     * @syscap SystemCapability.Communication.NetStack
3018     * @crossplatform
3019     * @since 10
3020     */
3021    /**
3022     * If the resultType is string, you can get result directly.
3023     * If the resultType is Object, you can get result such as this: result['key'].
3024     * If the resultType is ArrayBuffer, you can use ArrayBuffer to create the binary objects.
3025     * @type {HttpDataType}
3026     * @syscap SystemCapability.Communication.NetStack
3027     * @crossplatform
3028     * @atomicservice
3029     * @since 11
3030     */
3031    resultType: HttpDataType;
3032
3033    /**
3034     * Server status code.
3035     * @type {ResponseCode | number}
3036     * @syscap SystemCapability.Communication.NetStack
3037     * @since 6
3038     */
3039    /**
3040     * Server status code.
3041     * @type {ResponseCode | number}
3042     * @syscap SystemCapability.Communication.NetStack
3043     * @crossplatform
3044     * @since 10
3045     */
3046    /**
3047     * Server status code.
3048     * @type {ResponseCode | number}
3049     * @syscap SystemCapability.Communication.NetStack
3050     * @crossplatform
3051     * @atomicservice
3052     * @since 11
3053     */
3054    responseCode: ResponseCode | number;
3055
3056    /**
3057     * All headers in the response from the server.
3058     * @type {Object}
3059     * @syscap SystemCapability.Communication.NetStack
3060     * @since 6
3061     */
3062    /**
3063     * All headers in the response from the server.
3064     * @type {Object}
3065     * @syscap SystemCapability.Communication.NetStack
3066     * @crossplatform
3067     * @since 10
3068     */
3069    /**
3070     * All headers in the response from the server.
3071     * @type {Object}
3072     * @syscap SystemCapability.Communication.NetStack
3073     * @crossplatform
3074     * @atomicservice
3075     * @since 11
3076     */
3077    header: Object;
3078
3079    /**
3080     * Cookies returned by the server.
3081     * @type {string}
3082     * @syscap SystemCapability.Communication.NetStack
3083     * @since 8
3084     */
3085    /**
3086     * Cookies returned by the server.
3087     * @type {string}
3088     * @syscap SystemCapability.Communication.NetStack
3089     * @crossplatform
3090     * @since 10
3091     */
3092    /**
3093     * Cookies returned by the server.
3094     * @type {string}
3095     * @syscap SystemCapability.Communication.NetStack
3096     * @crossplatform
3097     * @atomicservice
3098     * @since 11
3099     */
3100    cookies: string;
3101
3102    /**
3103     * The time taken of various stages of HTTP request.
3104     * @type {PerformanceTiming}
3105     * @syscap SystemCapability.Communication.NetStack
3106     * @since 11
3107     */
3108    /**
3109     * The time taken of various stages of HTTP request.
3110     * @type {PerformanceTiming}
3111     * @syscap SystemCapability.Communication.NetStack
3112     * @crossplatform
3113     * @since 12
3114     */
3115    performanceTiming: PerformanceTiming;
3116  }
3117
3118  /**
3119   * Counting the time taken of various stages of HTTP request.
3120   * @interface PerformanceTiming
3121   * @syscap SystemCapability.Communication.NetStack
3122   * @since 11
3123   */
3124  /**
3125   * Counting the time taken of various stages of HTTP request.
3126   * @interface PerformanceTiming
3127   * @syscap SystemCapability.Communication.NetStack
3128   * @crossplatform
3129   * @since 12
3130   */
3131  export interface PerformanceTiming {
3132    /**
3133     * Time taken from startup to DNS resolution completion, in milliseconds.
3134     * @type {number}
3135     * @syscap SystemCapability.Communication.NetStack
3136     * @since 11
3137     */
3138    /**
3139     * Time taken from startup to DNS resolution completion, in milliseconds.
3140     * @type {number}
3141     * @syscap SystemCapability.Communication.NetStack
3142     * @crossplatform
3143     * @since 12
3144     */
3145    dnsTiming: number;
3146
3147    /**
3148     * Time taken from startup to TCP connection completion, in milliseconds.
3149     * @type {number}
3150     * @syscap SystemCapability.Communication.NetStack
3151     * @since 11
3152     */
3153    /**
3154     * Time taken from startup to TCP connection completion, in milliseconds.
3155     * @type {number}
3156     * @syscap SystemCapability.Communication.NetStack
3157     * @crossplatform
3158     * @since 12
3159     */
3160    tcpTiming: number;
3161
3162    /**
3163     * Time taken from startup to TLS connection completion, in milliseconds.
3164     * @type {number}
3165     * @syscap SystemCapability.Communication.NetStack
3166     * @since 11
3167     */
3168    /**
3169     * Time taken from startup to TLS connection completion, in milliseconds.
3170     * @type {number}
3171     * @syscap SystemCapability.Communication.NetStack
3172     * @crossplatform
3173     * @since 12
3174     */
3175    tlsTiming: number;
3176
3177    /**
3178     * Time taken from startup to start sending the first byte, in milliseconds.
3179     * @type {number}
3180     * @syscap SystemCapability.Communication.NetStack
3181     * @since 11
3182     */
3183    /**
3184     * Time taken from startup to start sending the first byte, in milliseconds.
3185     * @type {number}
3186     * @syscap SystemCapability.Communication.NetStack
3187     * @crossplatform
3188     * @since 12
3189     */
3190    firstSendTiming: number;
3191
3192    /**
3193     * Time taken from startup to receiving the first byte, in milliseconds.
3194     * @type {number}
3195     * @syscap SystemCapability.Communication.NetStack
3196     * @since 11
3197     */
3198    /**
3199     * Time taken from startup to receiving the first byte, in milliseconds.
3200     * @type {number}
3201     * @syscap SystemCapability.Communication.NetStack
3202     * @crossplatform
3203     * @since 12
3204     */
3205    firstReceiveTiming: number;
3206
3207    /**
3208     * Time taken from startup to the completion of the request, in milliseconds.
3209     * @type {number}
3210     * @syscap SystemCapability.Communication.NetStack
3211     * @since 11
3212     */
3213    /**
3214     * Time taken from startup to the completion of the request, in milliseconds.
3215     * @type {number}
3216     * @syscap SystemCapability.Communication.NetStack
3217     * @crossplatform
3218     * @since 12
3219     */
3220    totalFinishTiming: number;
3221
3222    /**
3223     * Time taken from startup to completion of all redirection steps, in milliseconds.
3224     * @type {number}
3225     * @syscap SystemCapability.Communication.NetStack
3226     * @since 11
3227     */
3228    /**
3229     * Time taken from startup to completion of all redirection steps, in milliseconds.
3230     * @type {number}
3231     * @syscap SystemCapability.Communication.NetStack
3232     * @crossplatform
3233     * @since 12
3234     */
3235    redirectTiming: number;
3236
3237    /**
3238     * Time taken from HTTP request to header completion, in milliseconds.
3239     * @type {number}
3240     * @syscap SystemCapability.Communication.NetStack
3241     * @since 11
3242     */
3243    /**
3244     * Time taken from HTTP request to header completion, in milliseconds.
3245     * @type {number}
3246     * @syscap SystemCapability.Communication.NetStack
3247     * @crossplatform
3248     * @since 12
3249     */
3250    responseHeaderTiming: number;
3251
3252    /**
3253     * Time taken from HTTP Request to body completion, in milliseconds.
3254     * @type {number}
3255     * @syscap SystemCapability.Communication.NetStack
3256     * @since 11
3257     */
3258    /**
3259     * Time taken from HTTP Request to body completion, in milliseconds.
3260     * @type {number}
3261     * @syscap SystemCapability.Communication.NetStack
3262     * @crossplatform
3263     * @since 12
3264     */
3265    responseBodyTiming: number;
3266
3267    /**
3268     * Time taken from HTTP Request to callback to the application, in milliseconds.
3269     * @type {number}
3270     * @syscap SystemCapability.Communication.NetStack
3271     * @since 11
3272     */
3273    /**
3274     * Time taken from HTTP Request to callback to the application, in milliseconds.
3275     * @type {number}
3276     * @syscap SystemCapability.Communication.NetStack
3277     * @crossplatform
3278     * @since 12
3279     */
3280    totalTiming: number;
3281  }
3282
3283  /**
3284   * This interface is used to obtain the progress information of file upload or download.
3285   * @interface DataReceiveProgressInfo
3286   * @syscap SystemCapability.Communication.NetStack
3287   * @since 11
3288   */
3289  /**
3290   * This interface is used to obtain the progress information of file upload or download.
3291   * @interface DataReceiveProgressInfo
3292   * @syscap SystemCapability.Communication.NetStack
3293   * @crossplatform
3294   * @since 12
3295   */
3296  /**
3297   * This interface is used to obtain the progress information of file upload or download.
3298   * @interface DataReceiveProgressInfo
3299   * @syscap SystemCapability.Communication.NetStack
3300   * @crossplatform
3301   * @atomicservice
3302   * @since 15
3303   */
3304  export interface DataReceiveProgressInfo {
3305    /**
3306     * Number of data bytes received.
3307     * @type { number }
3308     * @syscap SystemCapability.Communication.NetStack
3309     * @since 11
3310     */
3311    /**
3312     * Number of data bytes received.
3313     * @type { number }
3314     * @syscap SystemCapability.Communication.NetStack
3315     * @crossplatform
3316     * @since 12
3317     */
3318    /**
3319     * Number of data bytes received.
3320     * @type { number }
3321     * @syscap SystemCapability.Communication.NetStack
3322     * @crossplatform
3323     * @atomicservice
3324     * @since 15
3325     */
3326    receiveSize: number;
3327    /**
3328     * Total number of bytes to receive.
3329     * @type { number }
3330     * @syscap SystemCapability.Communication.NetStack
3331     * @since 11
3332     */
3333    /**
3334     * Total number of bytes to receive.
3335     * @type { number }
3336     * @syscap SystemCapability.Communication.NetStack
3337     * @crossplatform
3338     * @since 12
3339     */
3340    /**
3341     * Total number of bytes to receive.
3342     * @type { number }
3343     * @syscap SystemCapability.Communication.NetStack
3344     * @crossplatform
3345     * @atomicservice
3346     * @since 15
3347     */
3348    totalSize: number;
3349  }
3350
3351  /**
3352   * This interface is used to monitor the progress of sending data.
3353   * @interface DataSendProgressInfo
3354   * @syscap SystemCapability.Communication.NetStack
3355   * @since 11
3356   */
3357  /**
3358   * This interface is used to monitor the progress of sending data.
3359   * @interface DataSendProgressInfo
3360   * @syscap SystemCapability.Communication.NetStack
3361   * @crossplatform
3362   * @since 12
3363   */
3364  /**
3365   * This interface is used to monitor the progress of sending data.
3366   * @interface DataSendProgressInfo
3367   * @syscap SystemCapability.Communication.NetStack
3368   * @crossplatform
3369   * @atomicservice
3370   * @since 15
3371   */
3372  export interface DataSendProgressInfo {
3373    /**
3374     * Used to specify the data size to be sent.
3375     * @type { number }
3376     * @syscap SystemCapability.Communication.NetStack
3377     * @since 11
3378     */
3379    /**
3380     * Used to specify the data size to be sent.
3381     * @type { number }
3382     * @syscap SystemCapability.Communication.NetStack
3383     * @crossplatform
3384     * @since 12
3385     */
3386    /**
3387     * Used to specify the data size to be sent.
3388     * @type { number }
3389     * @syscap SystemCapability.Communication.NetStack
3390     * @crossplatform
3391     * @atomicservice
3392     * @since 15
3393     */
3394    sendSize: number;
3395    /**
3396     * Total number of bytes to receive.
3397     * @type { number }
3398     * @syscap SystemCapability.Communication.NetStack
3399     * @since 11
3400     */
3401    /**
3402     * Total number of bytes to receive.
3403     * @type { number }
3404     * @syscap SystemCapability.Communication.NetStack
3405     * @crossplatform
3406     * @since 12
3407     */
3408    /**
3409     * Total number of bytes to receive.
3410     * @type { number }
3411     * @syscap SystemCapability.Communication.NetStack
3412     * @crossplatform
3413     * @atomicservice
3414     * @since 15
3415     */
3416    totalSize: number;
3417  }
3418
3419  /**
3420   * Creates a default {@code HttpResponseCache} object to store the responses of HTTP access requests.
3421   * @param { number } cacheSize - the size of cache(max value is 10MB), default is 10*1024*1024(10MB).
3422   * @returns { HttpResponseCache } the HttpResponseCache of the createHttpResponseCache.
3423   * @syscap SystemCapability.Communication.NetStack
3424   * @since 9
3425   */
3426  /**
3427   * Creates a default {@code HttpResponseCache} object to store the responses of HTTP access requests.
3428   * @param { number } cacheSize - the size of cache(max value is 10MB), default is 10*1024*1024(10MB).
3429   * @returns { HttpResponseCache } the HttpResponseCache of the createHttpResponseCache.
3430   * @syscap SystemCapability.Communication.NetStack
3431   * @crossplatform
3432   * @since 10
3433   */
3434  /**
3435   * Creates a default {@code HttpResponseCache} object to store the responses of HTTP access requests.
3436   * @param { number } cacheSize - the size of cache(max value is 10MB), default is 10*1024*1024(10MB).
3437   * @returns { HttpResponseCache } the HttpResponseCache of the createHttpResponseCache.
3438   * @syscap SystemCapability.Communication.NetStack
3439   * @crossplatform
3440   * @atomicservice
3441   * @since 11
3442   */
3443  function createHttpResponseCache(cacheSize?: number): HttpResponseCache;
3444
3445  /**
3446   * Defines an object that stores the response to an HTTP request.
3447   * @interface HttpResponseCache
3448   * @syscap SystemCapability.Communication.NetStack
3449   * @since 9
3450   */
3451  /**
3452   * Defines an object that stores the response to an HTTP request.
3453   * @interface HttpResponseCache
3454   * @syscap SystemCapability.Communication.NetStack
3455   * @crossplatform
3456   * @since 10
3457   */
3458  /**
3459   * Defines an object that stores the response to an HTTP request.
3460   * @interface HttpResponseCache
3461   * @syscap SystemCapability.Communication.NetStack
3462   * @crossplatform
3463   * @atomicservice
3464   * @since 11
3465   */
3466  export interface HttpResponseCache {
3467    /**
3468     * Writes data in the cache to the file system so that all the cached data can be accessed in the next HTTP request.
3469     * @param { AsyncCallback<void> } callback - the callback of flush.
3470     * @syscap SystemCapability.Communication.NetStack
3471     * @since 9
3472     */
3473    /**
3474     * Writes data in the cache to the file system so that all the cached data can be accessed in the next HTTP request.
3475     * @param { AsyncCallback<void> } callback - the callback of flush.
3476     * @syscap SystemCapability.Communication.NetStack
3477     * @crossplatform
3478     * @since 10
3479     */
3480    /**
3481     * Writes data in the cache to the file system so that all the cached data can be accessed in the next HTTP request.
3482     * @param { AsyncCallback<void> } callback - the callback of flush.
3483     * @syscap SystemCapability.Communication.NetStack
3484     * @crossplatform
3485     * @atomicservice
3486     * @since 11
3487     */
3488    flush(callback: AsyncCallback<void>): void;
3489
3490    /**
3491     * Writes data in the cache to the file system so that all the cached data can be accessed in the next HTTP request.
3492     * @returns { Promise<void> } The promise returned by the flush.
3493     * @syscap SystemCapability.Communication.NetStack
3494     * @since 9
3495     */
3496    /**
3497     * Writes data in the cache to the file system so that all the cached data can be accessed in the next HTTP request.
3498     * @returns { Promise<void> } The promise returned by the flush.
3499     * @syscap SystemCapability.Communication.NetStack
3500     * @crossplatform
3501     * @since 10
3502     */
3503    /**
3504     * Writes data in the cache to the file system so that all the cached data can be accessed in the next HTTP request.
3505     * @returns { Promise<void> } The promise returned by the flush.
3506     * @syscap SystemCapability.Communication.NetStack
3507     * @crossplatform
3508     * @atomicservice
3509     * @since 11
3510     */
3511    flush(): Promise<void>;
3512
3513    /**
3514     * Disables a cache and deletes the data in it.
3515     * @param { AsyncCallback<void> } callback - the callback of delete.
3516     * @syscap SystemCapability.Communication.NetStack
3517     * @since 9
3518     */
3519    /**
3520     * Disables a cache and deletes the data in it.
3521     * @param { AsyncCallback<void> } callback - the callback of delete.
3522     * @syscap SystemCapability.Communication.NetStack
3523     * @crossplatform
3524     * @since 10
3525     */
3526    /**
3527     * Disables a cache and deletes the data in it.
3528     * @param { AsyncCallback<void> } callback - the callback of delete.
3529     * @syscap SystemCapability.Communication.NetStack
3530     * @crossplatform
3531     * @atomicservice
3532     * @since 11
3533     */
3534    delete(callback: AsyncCallback<void>): void;
3535
3536    /**
3537     * Disables a cache and deletes the data in it.
3538     * @returns { Promise<void> } The promise returned by the delete.
3539     * @syscap SystemCapability.Communication.NetStack
3540     * @since 9
3541     */
3542    /**
3543     * Disables a cache and deletes the data in it.
3544     * @returns { Promise<void> } The promise returned by the delete.
3545     * @syscap SystemCapability.Communication.NetStack
3546     * @crossplatform
3547     * @since 10
3548     */
3549    /**
3550     * Disables a cache and deletes the data in it.
3551     * @returns { Promise<void> } The promise returned by the delete.
3552     * @syscap SystemCapability.Communication.NetStack
3553     * @crossplatform
3554     * @atomicservice
3555     * @since 11
3556     */
3557    delete(): Promise<void>;
3558  }
3559}
3560
3561export default http;
3562