From 3ff3953dffea671c218334d6fba0105cc537c8bf Mon Sep 17 00:00:00 2001 From: hoteas <925970985@qq.com> Date: Tue, 30 Jun 2026 06:54:02 +0800 Subject: [PATCH] =?UTF-8?q?feat(api):=20=E6=96=B0=E5=A2=9E=20AtPath=20?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E4=BB=A5=E6=94=AF=E6=8C=81=E8=B7=A8=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E6=96=AD=E8=A8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 实现 AtPath 方法,返回指向其它 API 路径的 Api 实例,增强 API 的灵活性与可用性。 --- testing_api.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/testing_api.go b/testing_api.go index f91de7b..13093c1 100644 --- a/testing_api.go +++ b/testing_api.go @@ -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()