mirror of
https://github.com/projectdiscovery/nuclei.git
synced 2025-12-17 22:25:27 +00:00
Refactor to use reflect.TypeFor (#6428)
This commit is contained in:
parent
8194fabcf8
commit
d76187f99a
@ -59,7 +59,7 @@ func wrapModuleFunc(runtime *goja.Runtime, fn interface{}) interface{} {
|
||||
}
|
||||
|
||||
// Only wrap if first parameter is context.Context
|
||||
if fnType.NumIn() == 0 || fnType.In(0) != reflect.TypeOf((*context.Context)(nil)).Elem() {
|
||||
if fnType.NumIn() == 0 || fnType.In(0) != reflect.TypeFor[context.Context]() {
|
||||
return fn // Return original function unchanged if it doesn't have context.Context as first arg
|
||||
}
|
||||
|
||||
|
||||
@ -34,7 +34,7 @@ func wrapWithContext(runtime *goja.Runtime, fn interface{}) interface{} {
|
||||
}
|
||||
|
||||
// Only wrap if first parameter is context.Context
|
||||
if fnType.NumIn() == 0 || fnType.In(0) != reflect.TypeOf((*context.Context)(nil)).Elem() {
|
||||
if fnType.NumIn() == 0 || fnType.In(0) != reflect.TypeFor[context.Context]() {
|
||||
return fn // Return original function unchanged if it doesn't have context.Context as first arg
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user