Skip to content

Latest commit

 

History

History
22 lines (17 loc) · 477 Bytes

url_escape.md

File metadata and controls

22 lines (17 loc) · 477 Bytes

URL Escape Normalizer

The url-escape normalizer uses net.url.QueryEscape to escape the string so it can be safely placed inside a URL query.

type Request struct {
  Query string `checkers:"url-escape"`
}

request := &Request{
  Query: "param1/param2 = 1 + 2 & 3 + 4",
}

_, valid := checker.Check(request)
if !valid {
  t.Fail()
}

// Outputs: 
// param1%2Fparam2+%3D+1+%2B+2+%26+3+%2B+4
fmt.Println(request.Query)