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