MCPcopy
hub / github.com/hu17889/go_spider / TestDownloadJson

Function TestDownloadJson

core/downloader/downloader_test.go:60–79  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

58}
59
60func TestDownloadJson(t *testing.T) {
61 //return
62 var req *request.Request
63 req = request.NewRequest("http://live.sina.com.cn/zt/api/l/get/finance/globalnews1/index.htm?format=json&id=23521&pagesize=4&dire=f&dpc=1", "json", "", "GET", "", nil, nil, nil)
64
65 var dl downloader.Downloader
66 dl = downloader.NewHttpDownloader()
67
68 var p *page.Page
69 p = dl.Download(req)
70
71 var jsonMap interface{}
72 jsonMap = p.GetJson()
73 fmt.Printf("%v", jsonMap)
74
75 //fmt.Println(doc)
76 //body := p.GetBodyStr()
77 //fmt.Println(body)
78
79}
80
81func TestCharSetChange(t *testing.T) {
82 var req *request.Request

Callers

nothing calls this directly

Calls 2

DownloadMethod · 0.95
GetJsonMethod · 0.95

Tested by

no test coverage detected