| 10 | ) |
| 11 | |
| 12 | func TestLoadURLSuccess(t *testing.T) { |
| 13 | contentTypes := []string{ |
| 14 | "application/vnd.paos.xml", |
| 15 | "application/vnd.otps.ct-kip+xml", |
| 16 | "application/vnd.openxmlformats-package.core-properties+xml", |
| 17 | "application/CDFX+XML", |
| 18 | "application/ATXML", |
| 19 | "application/3gpdash-qoe-report+xml", |
| 20 | "application/vnd.nokia.pcd+wbxml", |
| 21 | "image/svg+xml", |
| 22 | "message/imdn+xml", |
| 23 | "model/vnd.collada+xml", |
| 24 | "text/xml-external-parsed-entity", |
| 25 | "text/xml", |
| 26 | "aPPLIcaTioN/xMl; charset=UTF-8", |
| 27 | "application/xhtml+xml", |
| 28 | "application/xml", |
| 29 | "text/xmL; charset=UTF-8", |
| 30 | "application/aTOM+xmL; charset=UTF-8", |
| 31 | "application/RsS+xmL; charset=UTF-8", |
| 32 | "application/maTHml+xmL; charset=UTF-8", |
| 33 | "application/xslt+xmL; charset=UTF-8", |
| 34 | } |
| 35 | |
| 36 | for _, contentType := range contentTypes { |
| 37 | server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { |
| 38 | s := `<?xml version="1.0"?> |
| 39 | <parent> |
| 40 | <child></child> |
| 41 | </parent> |
| 42 | ` |
| 43 | w.Header().Set("Content-Type", contentType) |
| 44 | w.Write([]byte(s)) |
| 45 | })) |
| 46 | defer server.Close() |
| 47 | _, err := LoadURL(server.URL) |
| 48 | if err != nil { |
| 49 | t.Fatal(err) |
| 50 | } |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | func TestLoadURLFailure(t *testing.T) { |
| 55 | contentTypes := []string{ |