httpnode

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 25, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package httpnode 提供发起 HTTP 请求的默认 node 节点。

HTTP client 可由注册选项注入,便于业务侧控制超时、代理和测试替身。

Index

Constants

View Source
const NodeType = "http"

Variables

This section is empty.

Functions

func Definition

func Definition(client *http.Client) node.Definition

Definition 返回 HTTP 节点的完整注册定义。

Types

type Config

type Config struct {
	Method    string            `json:"method"`
	URL       string            `json:"url"`
	TimeoutMs int               `json:"timeoutMs"`
	Headers   map[string]string `json:"headers"`
	Query     map[string]string `json:"query"`
	Body      interface{}       `json:"body"`
}

Config 是 HTTP node 从 node.config 解码得到的内部配置。

func DefaultConfig

func DefaultConfig() *Config

type Node

type Node struct {
	// contains filtered or unexported fields
}

Node 输出 statusCode、headers、body;JSON 响应会额外输出 json。 非 2xx 响应返回 NodeResult{Pass:false},由 runtime 的 retry/onError 策略统一处理。

func NewNode

func NewNode(client *http.Client) *Node

NewNode 允许宿主服务注入带超时、代理或测试替身的 client;nil 时使用 http.DefaultClient。

func (*Node) Execute

func (e *Node) Execute(fc *core.FlowContext, node *core.NodeDefine) (interface{}, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL