Skip to content

Commit

Permalink
feat: controller template has req header
Browse files Browse the repository at this point in the history
  • Loading branch information
Hidayat Hamir committed Feb 12, 2024
1 parent b6cbbe5 commit 69f2b93
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ go install github.com/spacetronot-research-team/erago@latest
or you can define your prefered version.

```shell
go install github.com/spacetronot-research-team/erago@v0.1.10
go install github.com/spacetronot-research-team/erago@v0.1.11
```

Or you can download erago binary from [release page](https://github.com/spacetronot-research-team/erago/releases).
Expand Down
7 changes: 6 additions & 1 deletion internal/repository/templ/controllertest.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ func Test{{.DomainPascalCase}}Controller_Qux(t *testing.T) {
{{.DomainCamelCase}}Service *mock.Mock{{.DomainPascalCase}}
}
type args struct {
reqHeader map[string]string
reqBody gin.H
}
tests := []struct {
Expand Down Expand Up @@ -78,7 +79,11 @@ func Test{{.DomainPascalCase}}Controller_Qux(t *testing.T) {
rr := httptest.NewRecorder()
ctx, _ := gin.CreateTestContext(rr)
reqBody, _ := json.Marshal(tt.args.reqBody)
ctx.Request = httptest.NewRequest(http.MethodGet, "/", bytes.NewReader(reqBody))
req := httptest.NewRequest(http.MethodGet, "/", bytes.NewReader(reqBody))
for k, v := range tt.args.reqHeader {
req.Header.Set(k, v)
}
ctx.Request = req
{{.DomainShort}}.Qux(ctx)
Expand Down
2 changes: 1 addition & 1 deletion pkg/version/version.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package version

const Current = "v0.1.10"
const Current = "v0.1.11"

0 comments on commit 69f2b93

Please sign in to comment.