Skip to content

Commit

Permalink
♻️ Refactor: Rename interface to any
Browse files Browse the repository at this point in the history
  • Loading branch information
JIeJaitt committed Nov 15, 2024
1 parent 0ba6c17 commit 0781d02
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion middleware/requestid/requestid.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func New(config ...Config) fiber.Handler {

// FromContext returns the request ID from context.
// If there is no request ID, an empty string is returned.
func FromContext(c interface{}) string {
func FromContext(c any) string {
switch ctx := c.(type) {
case fiber.Ctx:
if rid, ok := ctx.Locals(requestIDKey).(string); ok {
Expand Down
6 changes: 3 additions & 3 deletions middleware/requestid/requestid_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func Test_RequestID_FromContext(t *testing.T) {
reqID := "ThisIsARequestId"

type args struct {
inputFunc func(c fiber.Ctx) interface{}
inputFunc func(c fiber.Ctx) any
}

tests := []struct {
Expand All @@ -68,15 +68,15 @@ func Test_RequestID_FromContext(t *testing.T) {
{
name: "From fiber.Ctx",
args: args{
inputFunc: func(c fiber.Ctx) interface{} {
inputFunc: func(c fiber.Ctx) any {
return c
},
},
},
{
name: "From context.Context",
args: args{
inputFunc: func(c fiber.Ctx) interface{} {
inputFunc: func(c fiber.Ctx) any {
return c.Context()
},
},
Expand Down

0 comments on commit 0781d02

Please sign in to comment.