thedevsaddam / govalidator

Validate Golang request data with simple rules. Highly inspired by Laravel's request validation.
MIT License
1.31k stars 124 forks source link

added ConvertFastHttpRequest function that will help to convert fasthttp and gofiber context to net/http request #114

Open umerbilal-tech opened 2 years ago

umerbilal-tech commented 2 years ago

this function will help you to convert fasthttp and gofiber context to a http/net request so that fasthttp and gofiber users can also utilize this package

umerbilal-tech commented 2 years ago

i was using gofiber and i found your validator interesting because I am Laravel developer as well. but problem I found in your validator is that it only supports net/http request for validations. so to resolve that issue I added a new function through which user can convert there fasthttp request to net/http and continue to use your validator in gofiber and fasthttp. Example of using will be like opts := govalidator.Options{ Request: govalidator.ConvertFastHttpRequest(c.Context()), //c is gofiber context Rules: rules, // rules map Messages: messages, // custom message map (Optional) RequiredDefault: true, // all the field to be pass the rules }

umerbilal-tech commented 2 years ago

@thedevsaddam