Skip to content

Commit

Permalink
fix: Handler_test.Tpl content error
Browse files Browse the repository at this point in the history
--bug=1
  • Loading branch information
studyzy authored and kevwan committed Nov 8, 2024
1 parent 057c48f commit 5367092
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tools/goctl/api/gogen/handler_test.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ func Test{{.HandlerName}}(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
tt.setupMocks()
reqBody := []byte{}
{{if .HasRequest}}reqBody, err := json.Marshal(tt.reqBody)
var reqBody []byte
{{if .HasRequest}}var err error
reqBody, err = json.Marshal(tt.reqBody)
require.NoError(t, err){{end}}
req, err := http.NewRequest("POST", "/ut", bytes.NewBuffer(reqBody))
require.NoError(t, err)
Expand Down

0 comments on commit 5367092

Please sign in to comment.