DevEco Studio版本:4.0.0.600
参考文档:OpenHarmony http数据请求
File-->New-->Module,选择Static Library
HttpCore:Http的核心类,用于http的请求
RequestMethod:http请求的类型,包含:GET、POST等
RequestOptions:http的请求配置,包含:请求的url、请求头等
HttpManager:Http请求的管理类
然后在HttpLibrary的Index.ets类中添加对外输出的引用
export { HttpManager } from './src/main/ets/HttpManager'
export { RequestMethod } from './src/main/ets/http/RequestMethod'
import http from '@ohos.net.http';
import { RequestOptions } from './RequestOptions';
/**
* Http请求器
*/
export class HttpCore {
/**
* 发送请求
*/
request<T>(requestOption: RequestOptions): Promise<T> {