mirror of
https://github.com/projectdiscovery/nuclei.git
synced 2025-12-18 04:55:28 +00:00
fix recursive struct validation during JSON marshaling (#5883)
This commit is contained in:
parent
f21a82aac3
commit
358249bdb4
@ -521,7 +521,8 @@ func (template *Template) hasMultipleRequests() bool {
|
||||
|
||||
// MarshalJSON forces recursive struct validation during marshal operation
|
||||
func (template *Template) MarshalJSON() ([]byte, error) {
|
||||
out, marshalErr := json.Marshal(template)
|
||||
type TemplateAlias Template //avoid recursion
|
||||
out, marshalErr := json.Marshal((*TemplateAlias)(template))
|
||||
errValidate := validate.New().Struct(template)
|
||||
return out, multierr.Append(marshalErr, errValidate)
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user