| Name | Date | Size | #Lines | LOC | ||
|---|---|---|---|---|---|---|
| .. | - | - | ||||
| AppScope/ | 12-May-2024 | - | 36 | 33 | ||
| entry/ | 12-May-2024 | - | 791 | 664 | ||
| http/ | 12-May-2024 | - | 496 | 441 | ||
| hvigor/ | 12-May-2024 | - | 24 | 22 | ||
| screenshots/device/ | 12-May-2024 | - | ||||
| .gitignore | D | 12-May-2024 | 93 | 7 | 7 | |
| README.md | D | 12-May-2024 | 1.4 KiB | 40 | 20 | |
| README_zh.md | D | 12-May-2024 | 2.3 KiB | 75 | 50 | |
| build-profile.json5 | D | 12-May-2024 | 1.1 KiB | 47 | 45 | |
| hvigorfile.js | D | 12-May-2024 | 168 | 2 | 1 | |
| hvigorw | D | 12-May-2024 | 2.1 KiB | 62 | 28 | |
| hvigorw.bat | D | 12-May-2024 | 2 KiB | 72 | 56 | |
| oh-package.json5 | D | 12-May-2024 | 809 | 26 | 25 | |
| ohosTest.md | D | 12-May-2024 | 1 KiB | 14 | 12 |
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)等接口,实现了根据URL地址和相关配置项发起http请求的功能。 6 7### 效果预览 8 9|首页|结果页| 10|--------------------------------|--------------------------------| 11|| 12 13使用说明 14 151.启动应用可配置网络请求,设置网址、请求方式、请求参数; 16 172.点击确认按钮,跳转请求结果页面; 18 193.点击返回按钮,返回配置页面; 20 214.支持将本示例中的http模块编译成tgz包。 22 23### 工程目录 24 25``` 26entry/src/main/ets/ 27|---Application 28|---MainAbility 29| |---MainAbility.ts // 项目入口,请求相关权限 30|---page 31| |---Index.ets // 首页 32|---util // 日志文件 33http/src/main/ets/ 34|---components 35| |---MainPage 36| | |---MainPage.ets // 首页主体内容 37| |---model 38| | |---http.ts // 封装了http参数和发起请求的接口 39``` 40 41### 具体实现 42 43* 本示例将发送http请求的接口封装在Http模块,源码参考:[http.ts](http/src/main/ets/components/model/http.ts) 44 * 发起请求:在[MainPage.ets](http/src/main/ets/components/MainPage/MainPage.ets) 45 通过TextInput组件获取参数,点击“确认”按钮后通过Http.request()方法调用http.createHttp().request()接口向指定的地址发送请求。 46 47### 相关权限 48 49[ohos.permission.INTERNET](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/security/AccessToken/permissions-for-all.md#ohospermissioninternet) 50 51### 依赖 52 53不涉及。 54 55### 约束与限制 56 571.本示例仅支持标准系统上运行,支持设备:RK3568。 58 592.本示例为Stage模型,支持API10版本SDK,SDK版本号(API Version 10 Release),镜像版本号(4.0 Release) 60 613.本示例需要使用DevEco Studio 版本号(4.0 Release)及以上版本才可编译运行。 62 634.运行本示例需全程联网。 64 65### 下载 66 67如需单独下载本工程,执行如下命令: 68 69``` 70git init 71git config core.sparsecheckout true 72echo code/BasicFeature/Connectivity/Http/ > .git/info/sparse-checkout 73git remote add origin https://gitee.com/openharmony/applications_app_samples.git 74git pull origin master 75```