Name | Date | Size | ||
---|---|---|---|---|
.. | 25-Oct-2024 | 4 KiB | ||
.gitignore | H A D | 25-Oct-2024 | 93 | |
AppScope/ | H | 25-Oct-2024 | 4 KiB | |
build-profile.json5 | H A D | 25-Oct-2024 | 1.1 KiB | |
entry/ | H | 25-Oct-2024 | 4 KiB | |
http/ | H | 25-Oct-2024 | 4 KiB | |
hvigor/ | H | 25-Oct-2024 | 4 KiB | |
hvigorfile.js | H A D | 25-Oct-2024 | 168 | |
hvigorw | H A D | 25-Oct-2024 | 2.1 KiB | |
hvigorw.bat | H A D | 25-Oct-2024 | 2 KiB | |
oh-package.json5 | H A D | 25-Oct-2024 | 809 | |
ohosTest.md | H A D | 25-Oct-2024 | 1 KiB | |
README.md | H A D | 25-Oct-2024 | 1.4 KiB | |
README_zh.md | H A D | 25-Oct-2024 | 2.3 KiB | |
screenshots/device/ | H | 25-Oct-2024 | 4 KiB |
README.md
1# HTTP 2 3### Introduction 4 5This sample shows how to use the **TextInput** component to enter parameters and use the **Text** component to display the return result. 6 7In this example, we'll use [SystemCapability.Communication.NetStack](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-http.md) to initiate HTTP network requests to the destination URL based on specified configuration. 8 9Usage 10 111. When starting the sample application, configure the network request by specifying the destination URL, request mode, and request parameters. 12 132. Click **OK**. The request result page is displayed. 14 153. Click **Back** to return to the configuration page. 16 17NOTE: You can compile the http module into a **.tgz** package depending on your need. 18 19### Display Effect 20 21  22 23### Required Permissions 24 25Access to the Internet: [ohos.permission.INTERNET](https://gitee.com/openharmony/docs/blob/master/en/application-dev/security/permission-list.md) 26 27### Dependency 28 29N/A 30 31### Constraints 32 331. This sample can only be run on standard-system devices that use the Rockchip RK3568 chip. 34 352. This sample demonstrates the stage model, which supports only the SDK of API version 10 (SDK version: 4.0 Release). 36 373. DevEco Studio 4.0 Release must be used. 38 394. This sample requires network connection throughout the entire process. 40
README_zh.md
1# Http 2 3### 介绍 4 5本示例通过[@ohos.net.http](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis-network-kit/js-apis-http.md) 6等接口,实现了根据URL地址和相关配置项发起http请求的功能。 7 8### 效果预览 9 10|首页|结果页| 11|--------------------------------|--------------------------------| 12|| 13 14使用说明 15 161.启动应用可配置网络请求,设置网址、请求方式、请求参数; 17 182.点击确认按钮,跳转请求结果页面; 19 203.点击返回按钮,返回配置页面; 21 224.支持将本示例中的http模块编译成tgz包。 23 24### 工程目录 25 26``` 27entry/src/main/ets/ 28|---Application 29|---MainAbility 30| |---MainAbility.ts // 项目入口,请求相关权限 31|---page 32| |---Index.ets // 首页 33|---util // 日志文件 34http/src/main/ets/ 35|---components 36| |---MainPage 37| | |---MainPage.ets // 首页主体内容 38| |---model 39| | |---http.ts // 封装了http参数和发起请求的接口 40``` 41 42### 具体实现 43 44* 本示例将发送http请求的接口封装在Http模块,源码参考:[http.ts](http/src/main/ets/components/model/http.ts) 45 * 发起请求:在[MainPage.ets](http/src/main/ets/components/MainPage/MainPage.ets) 46 通过TextInput组件获取参数,点击“确认”按钮后通过Http.request()方法调用http.createHttp().request()接口向指定的地址发送请求。 47 48### 相关权限 49 50[ohos.permission.INTERNET](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/security/AccessToken/permissions-for-all.md#ohospermissioninternet) 51 52### 依赖 53 54不涉及。 55 56### 约束与限制 57 581.本示例仅支持标准系统上运行,支持设备:RK3568。 59 602.本示例为Stage模型,支持API10版本SDK,SDK版本号(API Version 10 Release),镜像版本号(4.0 Release) 61 623.本示例需要使用DevEco Studio 版本号(4.0 Release)及以上版本才可编译运行。 63 644.运行本示例需全程联网。 65 66### 下载 67 68如需单独下载本工程,执行如下命令: 69 70``` 71git init 72git config core.sparsecheckout true 73echo code/BasicFeature/Connectivity/Http/ > .git/info/sparse-checkout 74git remote add origin https://gitee.com/openharmony/applications_app_samples.git 75git pull origin master 76```