asaskevich / govalidator

[Go] Package of validators and sanitizers for strings, numerics, slices and structs
MIT License
6.06k stars 556 forks source link

IsRequestURI fails for non-absolute URLs #477

Open andrewpmartinez opened 2 years ago

andrewpmartinez commented 2 years ago

Bug Report

Q A
Version(s) v11.0.1 and earlier?

Summary

APIs that return relative URIs fail to validate as url.ParseRequestURI is used instead of url.Parse. ParseRequestURI is documented as:

... the url is interpreted only as an absolute URI or an absolute path.

Current behavior

Relative URIs fail validation (e.g. ./some-path)

How to reproduce

Attempt to validate a relative URI. (e.g. ./some-path)

Expected behavior

Aboslute and relative URIs pass validation.