首页龙虾技能列表 › SimpleHttpSkill — 技能工具

SimpleHttpSkill — 技能工具

v0.1.0

[自动翻译] Make HTTP requests (GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS) with custom headers, automatic retries, and graceful error handling. Use when the us...

0· 483·0 当前·0 累计
by @stephen-standridge (Stephen Standridge)·MIT-0
下载技能包
License
MIT-0
最后更新
2026/4/9
安全扫描
VirusTotal
可疑
查看报告
OpenClaw
安全
high confidence
This skill is internally consistent with its stated purpose: a small Node.js HTTP client that uses only built-in modules and does not request extra credentials or perform unexpected actions.
评估建议
This skill appears to do exactly what it says: make HTTP requests using built-in Node modules with retries and graceful errors. Before installing, consider that the skill can send arbitrary requests to any URL you provide (including any headers you pass), so do not supply sensitive tokens or credentials unless you trust the agent and target endpoint. If you want to limit risk, run the skill in a restricted environment or network sandbox, and avoid embedding secrets in defaultHeaders; prefer pass...
详细分析 ▾
用途与能力
The name/description match the code and SKILL.md: a generic HTTP client with retries and backoff. There are no unrelated environment variables, binaries, or configuration paths requested.
指令范围
The SKILL.md instructs the agent to import and use the included src/http-client.js and documents inputs/outputs and behavior. It does not direct the agent to read unrelated files, environment variables, or send data to endpoints other than those provided by the caller.
安装机制
No install spec is provided (instruction-only deployment) and the included code is a small local JS file. Nothing is downloaded from external URLs or written to system locations during install.
凭证需求
The skill requests no environment variables or credentials, which is appropriate. Note: callers can supply arbitrary headers (e.g., Authorization) so the skill can transmit sensitive tokens if you provide them — the skill itself does not request or store secrets.
持久化与权限
always is false and the skill does not request persistent system-level privileges or modify other skills. It is user-invocable and may be invoked autonomously by the agent (platform default).
安全有层次,运行前请审查代码。

License

MIT-0

可自由使用、修改和再分发,无需署名。

运行时依赖

无特殊依赖

版本

latestv0.1.02026/2/27

Initial release: Simple HTTP requests in Node.js with retries and robust error handling. - Supports all HTTP methods (GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS). - Allows custom headers and auto-serializes object bodies to JSON. - Handles automatic retries with exponential backoff on transient failures. - Provides consistent response objects, never throws errors—failures are inspectable. - No external dependencies; uses Node.js built-in modules only.

● 可疑

安装命令 点击复制

官方npx clawhub@latest install simplehttpskill
镜像加速npx clawhub@latest install simplehttpskill --registry https://cn.clawhub-mirror.com

技能文档

Make HTTP requests using only Node.js built-in modules. Supports all standard methods, arbitrary headers, automatic retries with exponential backoff, and never throws on failure — always resolves with an inspectable response object.

Required Inputs

  • url (string): Fully qualified URL to request.
  • method (string, optional): HTTP method. Default GET.
  • headers (object, optional): Request headers.
  • body (string | Buffer | object, optional): Request body. Objects are auto-serialized to JSON.
  • maxRetries (number, optional): Retry attempts for transient failures. Default 3.
  • timeout (number, optional): Socket timeout in ms. Default 30000.

Step-by-Step Workflow

  • Import the client from src/http-client.js:
const { HttpClient } = require("./src/http-client");
  • Create a client instance (optionally set default headers shared across calls):
const client = new HttpClient({
  defaultHeaders: { Authorization: "Bearer " },
  maxRetries: 3,
});
  • Make requests using convenience methods or the generic request():
// GET
const resp = await client.get("https://api.example.com/items");

// POST with JSON body const resp = await client.post("https://api.example.com/items", { body: { name: "widget" }, });

// PUT with custom headers const resp = await client.put("https://api.example.com/items/1", { headers: { "X-Request-Id": "abc123" }, body: { name: "updated" }, });

// DELETE const resp = await client.delete("https://api.example.com/items/1");

// Generic form — any method const resp = await client.request("PATCH", "https://api.example.com/items/1", { body: { qty: 5 }, });

  • Inspect the response:
if (resp.ok) {
  console.log(resp.body);      // parsed JSON or raw string
  console.log(resp.status);    // e.g. 200
  console.log(resp.headers);   // response headers object
} else {
  console.log(resp.error);     // human-readable error (null if HTTP error with status)
  console.log(resp.status);    // HTTP status code or null for network errors
}

Output Format

Every call resolves with an object containing:

KeyTypeDescription
okbooleantrue if status is 2xx
statusnumber \nullHTTP status code; null for network-level errors
headersobjectResponse headers
bodyanyParsed JSON (if content-type is JSON), else string
errorstring \nullError description on failure; null on success

Error Handling & Retry Behavior

  • Retried automatically: Connection errors, timeouts, and HTTP 429 / 5xx responses.
  • Not retried: 4xx errors (except 429) — returned immediately.
  • Backoff: Exponential with jitter (base 500ms, capped at 30s).
  • Graceful failure: The client never throws. After exhausting retries, it resolves with the last error response so the caller can always inspect resp.ok and resp.error.

Configuration Options

All options can be set at the client level (constructor) and overridden per-request:

OptionDefaultDescription
defaultHeaders{}Headers applied to every request
maxRetries3Max retry attempts
timeout30000Socket timeout in ms
backoffBase500Base delay (ms) for exponential backoff
backoffMax30000Maximum backoff delay cap (ms)

Dependencies

None — uses only Node.js built-in modules (http, https, url).

数据来源:ClawHub ↗ · 中文优化:龙虾技能库
OpenClaw 技能定制 / 插件定制 / 私有工作流定制

免费技能或插件可能存在安全风险,如需更匹配、更安全的方案,建议联系付费定制

了解定制服务