Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenRequests

Unreal Engine C++ License Platform

通用 HTTP 请求蓝图插件,为 Unreal Engine 5.x 提供简洁易用的异步 HTTP 请求节点和 JSON 构建工具。

功能特性

  • 支持 GET、POST、PUT、DELETE、PATCH、HEAD、OPTIONS 请求方法
  • 异步执行,不阻塞游戏线程
  • 多执行引脚(成功/失败/超时)
  • 支持自定义 Headers
  • 支持多种认证方式(Bearer Token、Basic Auth、API Key)
  • 可配置超时时间
  • 完整的 JSON 构建和解析工具链

安装

OpenRequests 文件夹复制到项目的 Plugins 目录,重新生成项目文件后编译。

蓝图节点

HTTP 请求节点

HTTP Request

主要的异步请求节点,支持完整配置。

输入:

  • URL - 完整请求地址
  • Method - 请求方法配置(预设 + 自定义)
  • Body - 请求体(JSON 字符串)
  • Config - 请求配置(超时、Content-Type、认证、自定义头)

输出引脚:

  • On Success - 2xx 状态码时触发
  • On Failure - 非 2xx 或网络错误时触发
  • On Timeout - 请求超时时触发

HTTP Request (Simple)

简化版请求节点,使用默认配置。

JSON 构建节点(纯函数,无执行引脚)

字段构建

  • Build JSON String Field - 构建字符串字段 "key": "value"
  • Build JSON Number Field - 构建数值字段 "key": 123.45
  • Build JSON Integer Field - 构建整数字段 "key": 123
  • Build JSON Bool Field - 构建布尔字段 "key": true
  • Build JSON Null Field - 构建空值字段 "key": null
  • Build JSON Array Field - 构建数组字段 "key": [...]
  • Build JSON Object Field - 构建对象字段 "key": {...}
  • Build JSON Raw Field - 构建原始 JSON 字段

组合节点

  • Merge JSON Fields - 合并多个字段(数组输入)
  • Merge Two JSON Fields - 合并两个字段
  • Finish Build JSON Object - 完成构建 JSON 对象 {...}
  • Finish Build JSON Array - 完成构建 JSON 数组 [...]
  • Wrap As JSON Object - 包装为 JSON 对象
  • Wrap As JSON Array - 包装为 JSON 数组

JSON 解析节点(纯函数)

  • Select from JSON - 从 JSON 中选取字段(支持嵌套路径如 data.user.name
  • Get JSON String Field - 获取字符串字段
  • Get JSON Number Field - 获取数值字段
  • Get JSON Bool Field - 获取布尔字段
  • Get JSON Array Field - 获取数组字段
  • Get JSON Array Length - 获取数组长度
  • Get JSON Array Element - 获取数组元素
  • Parse JSON to Map - JSON 转 Map
  • Map to JSON String - Map 转 JSON

工具节点(纯函数)

URL 工具

  • Build URL - 构建完整 URL
  • Add Query Parameters - 添加查询参数
  • URL Encode / URL Decode

编码工具

  • Base64 Encode / Base64 Decode

HTTP 状态码工具

  • Is Success Status Code - 判断是否成功
  • Get Status Code Description - 获取状态码描述

使用示例

基本 GET 请求

HTTP Request (Simple)
├─ URL: "https://api.example.com/users"
├─ Method: GET
└─ Body: ""
   ├─ On Success → 处理响应
   └─ On Failure → 显示错误

构建 JSON 请求体

Build JSON String Field ("name", "John")     ─┐
Build JSON Number Field ("age", 25)          ─┼─→ Make Array → Merge JSON Fields → Finish Build JSON Object
Build JSON Bool Field ("active", true)       ─┘
                                                  输出: {"name": "John", "age": 25, "active": true}

POST 请求带认证

HTTP Request
├─ URL: "https://api.example.com/data"
├─ Method: POST
├─ Body: (构建的 JSON)
└─ Config:
   ├─ Timeout: 30s
   ├─ Content-Type: application/json
   └─ Auth:
      ├─ Preset: Bearer Token
      └─ Token: "your-api-key"

响应数据结构

FHttpResponseData:

  • StatusCode (int32) - HTTP 状态码
  • Content (FString) - 响应内容
  • bSuccess (bool) - 是否成功
  • ErrorMessage (FString) - 错误信息
  • Headers (TMap) - 响应头

依赖模块

  • Core
  • CoreUObject
  • Engine
  • HTTP
  • Json
  • JsonUtilities

兼容性

  • Unreal Engine 5.1+
  • Windows / Mac / Linux

许可证

MIT License

作者

Chen Xuanyi

About

通用 HTTP 请求蓝图插件,支持想任意 REST API 发送异步请求,提供成功/失败/超时多执行引脚

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages