Skip to content

Commit f22aba1

Browse files
committed
fix lint
1 parent 0bf1cdf commit f22aba1

3 files changed

Lines changed: 39 additions & 39 deletions

File tree

backend/api/handler/coze/loop/apis/experiment_service_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ func TestExperimentServiceHandlers(t *testing.T) {
175175

176176
// 验证状态码
177177
actualStatus := c.Response.StatusCode()
178-
178+
179179
// 根据handler类型验证状态码
180180
if tt.requestBody == `{invalid json}` {
181181
// 有些handler会忽略JSON解析错误,直接返回200
@@ -320,4 +320,4 @@ func TestHandlerEdgeCases(t *testing.T) {
320320
assert.True(t, statusCode == http.StatusOK || statusCode == http.StatusBadRequest)
321321
})
322322
}
323-
}
323+
}

backend/api/router/coze/loop/apis/middleware_test.go

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ func TestRootMw(t *testing.T) {
2020
t.Parallel()
2121

2222
tests := []struct {
23-
name string
24-
setupHandler func() *apis.APIHandler
25-
expectedCount int
26-
wantPanic bool
23+
name string
24+
setupHandler func() *apis.APIHandler
25+
expectedCount int
26+
wantPanic bool
2727
}{
2828
{
2929
name: "成功配置根中间件",
@@ -84,10 +84,10 @@ func TestApiMw(t *testing.T) {
8484
t.Parallel()
8585

8686
tests := []struct {
87-
name string
88-
setupHandler func() *apis.APIHandler
89-
expectedCount int
90-
wantPanic bool
87+
name string
88+
setupHandler func() *apis.APIHandler
89+
expectedCount int
90+
wantPanic bool
9191
}{
9292
{
9393
name: "成功配置API中间件",
@@ -136,10 +136,10 @@ func TestLoopMw(t *testing.T) {
136136
t.Parallel()
137137

138138
tests := []struct {
139-
name string
140-
setupHandler func() *apis.APIHandler
141-
expectedCount int
142-
wantPanic bool
139+
name string
140+
setupHandler func() *apis.APIHandler
141+
expectedCount int
142+
wantPanic bool
143143
}{
144144
{
145145
name: "成功配置Loop中间件",
@@ -310,40 +310,40 @@ func TestMiddlewareParameterValidation(t *testing.T) {
310310
t.Parallel()
311311

312312
tests := []struct {
313-
name string
313+
name string
314314
middlewareFunc func(*apis.APIHandler) []app.HandlerFunc
315-
funcName string
316-
shouldPanic bool
315+
funcName string
316+
shouldPanic bool
317317
}{
318318
{
319-
name: "rootMw with nil handler",
319+
name: "rootMw with nil handler",
320320
middlewareFunc: rootMw,
321-
funcName: "rootMw",
322-
shouldPanic: true,
321+
funcName: "rootMw",
322+
shouldPanic: true,
323323
},
324324
{
325-
name: "_apiMw with nil handler",
325+
name: "_apiMw with nil handler",
326326
middlewareFunc: _apiMw,
327-
funcName: "_apiMw",
328-
shouldPanic: false,
327+
funcName: "_apiMw",
328+
shouldPanic: false,
329329
},
330330
{
331-
name: "_loopMw with nil handler",
331+
name: "_loopMw with nil handler",
332332
middlewareFunc: _loopMw,
333-
funcName: "_loopMw",
334-
shouldPanic: false,
333+
funcName: "_loopMw",
334+
shouldPanic: false,
335335
},
336336
{
337-
name: "_authMw with nil handler",
337+
name: "_authMw with nil handler",
338338
middlewareFunc: _authMw,
339-
funcName: "_authMw",
340-
shouldPanic: false, // 这个函数不依赖handler,所以不会panic
339+
funcName: "_authMw",
340+
shouldPanic: false, // 这个函数不依赖handler,所以不会panic
341341
},
342342
{
343-
name: "_v1Mw with nil handler",
343+
name: "_v1Mw with nil handler",
344344
middlewareFunc: _v1Mw,
345-
funcName: "_v1Mw",
346-
shouldPanic: false, // 这个函数不依赖handler,所以不会panic
345+
funcName: "_v1Mw",
346+
shouldPanic: false, // 这个函数不依赖handler,所以不会panic
347347
},
348348
}
349349

@@ -405,10 +405,10 @@ func TestMiddlewareWithMockDependencies(t *testing.T) {
405405
}
406406

407407
middlewares := rootMw(handler)
408-
408+
409409
// 验证中间件数量和类型
410410
assert.Equal(t, 4, len(middlewares))
411-
411+
412412
// 验证所有中间件都是有效的函数
413413
for i, mw := range middlewares {
414414
assert.NotNil(t, mw, "middleware %d should not be nil", i)
@@ -421,7 +421,7 @@ func TestMiddlewareWithMockDependencies(t *testing.T) {
421421

422422
handler := &apis.APIHandler{}
423423
middlewares := _apiMw(handler)
424-
424+
425425
// 验证SessionMW被正确创建
426426
assert.Equal(t, 1, len(middlewares))
427427
assert.NotNil(t, middlewares[0])
@@ -433,7 +433,7 @@ func TestMiddlewareWithMockDependencies(t *testing.T) {
433433

434434
handler := &apis.APIHandler{}
435435
middlewares := _loopMw(handler)
436-
436+
437437
// 验证PatTokenVerifyMW被正确创建
438438
assert.Equal(t, 1, len(middlewares))
439439
assert.NotNil(t, middlewares[0])
@@ -491,7 +491,7 @@ func TestMiddlewareConsistency(t *testing.T) {
491491
mw2 := rootMw(handler)
492492

493493
assert.Equal(t, len(mw1), len(mw2))
494-
494+
495495
// 验证两次调用返回的中间件数量相同
496496
assert.Equal(t, 4, len(mw1))
497497
assert.Equal(t, 4, len(mw2))
@@ -510,4 +510,4 @@ func TestMiddlewareConsistency(t *testing.T) {
510510
assert.Equal(t, 4, len(mw1))
511511
assert.Equal(t, 4, len(mw2))
512512
})
513-
}
513+
}

backend/infra/http/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,4 +107,4 @@ func (c *HTTPClient) DoHTTPRequest(ctx context.Context, requestParam *RequestPar
107107
}
108108

109109
return nil
110-
}
110+
}

0 commit comments

Comments
 (0)