feat(api): 新增 AtPath 方法以支持跨接口断言

- 实现 AtPath 方法,返回指向其它 API 路径的 Api 实例,增强 API 的灵活性与可用性。
This commit is contained in:
2026-06-30 06:54:02 +08:00
parent 1e77dde6f0
commit 8b095f87ea
+10
View File
@@ -61,6 +61,16 @@ func (a *Api) WithSession(s Map) *Api {
}
}
// AtPath 返回指向其它 API 路径的 Api(跨接口断言时用)
func (a *Api) AtPath(path string) *Api {
return &Api{
app: a.app,
path: path,
t: a.t,
session: a.session,
}
}
// JSON 设置 JSON body,返回 ApiCase 构建器
func (a *Api) JSON(body interface{}) *ApiCase {
c := a.newCase()