import { rcp } from "@kit.RemoteCommunicationKit"; const BASE_URL: string = "https://192.168.31.217:5000"; export interface IReqestParams { path?: string; method?: 'GET' | "POST" | "PUT" | "DELETE"; data?: rcp.RequestContent; contentType?: string; } const TAG: string = "HttpClient: "; export class HttpClient { request<R>(params: IReqestParams): Promise<R> { let hint: string = "request: " return new Promise((resolve, reject) => { let request: rcp.Request = new rcp.Request(BASE_URL + params.path, params.method, { accept: 'application/json', "content-type": params.contentType ?? 'application/json' } , params.data, {}, undefined, { security: { remoteValidation: "skip" } } ) let configure: rcp.SessionConfiguration = { requestConfiguration: { security: { remoteValidation: "skip", tlsOptions: { tlsVersion: 'TlsV1.3' } } } }; let session: rcp.Session = rcp.createSession(configure); session.fetch(request) .then((response: rcp.Response) => { console.info(TAG, hint, "then response = ", response?.toJSON()); resolve(response as R); }) .catch((error: BusinessError) => { console.error(TAG, hint, "error code = ",error?.code, ", message = ",error?.message); reject(error); }) }); } upload<R>(path: string, data: rcp.MultipartForm): Promise<R> { return this.request({ path: path, method: "POST", data: data, contentType: 'multipart/form-data' }) } }client https
张小明
前端开发工程师
LabelLLM开源数据标注平台终极指南:3大核心场景实战解析
LabelLLM开源数据标注平台终极指南:3大核心场景实战解析 【免费下载链接】LabelLLM 项目地址: https://gitcode.com/gh_mirrors/la/LabelLLM LabelLLM开源数据标注平台凭借其智能标注工作流和零配置部署特性,正在重新定义AI辅助标注的标准。本文…
Cursor Pro工具完全指南:从限制突破到功能激活
Cursor Pro工具完全指南:从限制突破到功能激活 【免费下载链接】cursor-free-vip [Support 0.45](Multi Language 多语言)自动注册 Cursor Ai ,自动重置机器ID , 免费升级使用Pro 功能: Youve reached your trial requ…
x11vnc 0.9.17版本全面解析:远程控制工具的革新与突破
还在为远程控制X Window系统而烦恼吗?x11vnc 0.9.17版本的发布为Linux远程桌面体验带来了革命性的变化。作为一款成熟的VNC服务器,x11vnc在最新版本中不仅解决了诸多技术难题,更在输入设备支持、显示优化和安全性方面实现了质的飞跃。 【免费…
RuoYi-Flowable工作流平台极速实战:一键部署完整配置方案
RuoYi-Flowable工作流平台极速实战:一键部署完整配置方案 【免费下载链接】RuoYi-Flowable-Plus 本项目基于 RuoYi-Vue-Plus 进行二次开发扩展Flowable工作流功能,支持在线表单设计和丰富的工作流程设计能力。如果觉得这个项目不错,麻烦点个s…
BuildMaster构筑模拟器终极评测:流放之路角色规划神器
在《流放之路》这款深度复杂的ARPG中,如何避免资源浪费、打造完美构筑成为每个玩家的核心挑战。今天我们要深度评测的BuildMaster构筑模拟器,正是为解决这一痛点而生的专业工具。这款开源的角色规划器和伤害计算器,让你在实际投入游戏前就能精…
信号发生器UART接口参数设置操作指南
从零打通信号发生器串口控制:UART参数配置实战全解析你有没有遇到过这样的场景?调试一台新到的信号发生器,接好线、写好代码,满怀期待地发送第一条命令——结果石沉大海,串口助手一片空白。再试一次,收到的…