Skip to content

Commit

Permalink
fix: SetContext covers value (#352)
Browse files Browse the repository at this point in the history
* fix: SetContext covers value

* chore: update mocks

* Fix unit test

* Fix unit test

* Remove SetContext

* chore: update mocks

---------

Co-authored-by: hwbrzzl <hwbrzzl@users.noreply.github.com>
  • Loading branch information
hwbrzzl and hwbrzzl committed Nov 21, 2023
1 parent 50ecec9 commit e91df53
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 25 deletions.
4 changes: 0 additions & 4 deletions auth/auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,6 @@ func (mc *Context) Response() http.ContextResponse {
return mc.response
}

func (mc *Context) SetContext(ctx http.Context) {
mc.ctx = ctx.Context()
}

func Background() http.Context {
return &Context{
ctx: context.Background(),
Expand Down
2 changes: 0 additions & 2 deletions contracts/http/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,4 @@ type Context interface {
Request() ContextRequest
// Response returns the ContextResponse
Response() ContextResponse
// SetContext set the custom context
SetContext(ctx Context)
}
4 changes: 0 additions & 4 deletions http/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,3 @@ func (r *Context) Request() http.ContextRequest {
func (r *Context) Response() http.ContextResponse {
return nil
}

func (r *Context) SetContext(ctx http.Context) {
r.Ctx = ctx.Context()
}
6 changes: 0 additions & 6 deletions http/context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,3 @@ func (s *ContextTestSuite) TestRequest() {
func (s *ContextTestSuite) TestResponse() {
s.Nil(s.ctx.Response())
}

func (s *ContextTestSuite) TestSetContext() {
ctx := NewContext()
s.ctx.SetContext(ctx)
s.Equal(ctx.Context(), s.ctx.Context())
}
4 changes: 0 additions & 4 deletions http/middleware/throttle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,10 +283,6 @@ func (r *TestContext) Response() contractshttp.ContextResponse {
return r.response
}

func (r *TestContext) SetContext(ctx contractshttp.Context) {
panic("do not need to implement it")
}

type TestRequest struct{}

func (r *TestRequest) Header(key string, defaultValue ...string) string {
Expand Down
5 changes: 0 additions & 5 deletions mocks/http/Context.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e91df53

Please sign in to comment.