| 58 | } |
| 59 | |
| 60 | func 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 | |
| 81 | func TestCharSetChange(t *testing.T) { |
| 82 | var req *request.Request |