Codebase list golang-github-tdewolff-parse / 8a4cf11
Data URI: escape space characters as defined as excluded character in RFC2396 Taco de Wolff 2 years ago
1 changed file(s) with 16 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
273273 }
274274 }
275275
276 func TestEncodeDataURI(t *testing.T) {
277 var urlTests = []struct {
278 url string
279 expected string
280 }{
281 {"a b", "a+b"},
282 {`<svg xmlns="http://www.w3.org/2000/svg"></svg>`, `%3Csvg+xmlns=%22http://www.w3.org/2000/svg%22%3E%3C/svg%3E`},
283 }
284 for _, tt := range urlTests {
285 t.Run(tt.url, func(t *testing.T) {
286 b := EncodeURL([]byte(tt.url), DataURIEncodingTable)
287 test.T(t, string(b), tt.expected, "in '"+tt.url+"'")
288 })
289 }
290 }
291
276292 func TestEncodeURLRandom(t *testing.T) {
277293 for _, e := range urlSlices {
278294 reference := url.QueryEscape(string(e))