Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: SetContext covers value #352

Merged
merged 6 commits into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.