feat(api): 新增 AtPath 方法以支持跨接口断言
- 实现 AtPath 方法,返回指向其它 API 路径的 Api 实例,增强 API 的灵活性与可用性。
This commit is contained in:
@@ -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 构建器
|
// JSON 设置 JSON body,返回 ApiCase 构建器
|
||||||
func (a *Api) JSON(body interface{}) *ApiCase {
|
func (a *Api) JSON(body interface{}) *ApiCase {
|
||||||
c := a.newCase()
|
c := a.newCase()
|
||||||
|
|||||||
Reference in New Issue
Block a user