我正在嘗試對返回VAST標記的某個網址發出GET請求。當我捲曲的URL,curl -v 'http://a.host.for.vasttag.com/foo/ad.jsp?fooid=someidhere'
我收到普通的HTML這樣的:Node.js請求獲取VAST標記
<script type="text/javascript" src="foobar.js"></script><script type="text/javascript">var FOO_customization = {"account":"foo1","playerid":"foo1232","inapp":"true","domain":"foodomain.com"}</script><script type="text/javascript" id="exampleBanner" src="http://this.is.net/banner/LATEST/inbanner.min.js"></script>
我希望收到我node.app的相同響應,但我只收到此:
<?xml version="1.0" encoding="utf-8"?> <VAST version="3.0"></VAST>
我做錯了什麼?這裏是我的代碼:
var http = require('http')
var options = {
method : 'GET',
host: 'a.host.for.vasttag.com',
port: 80,
path: '/foo/ad.jsp?fooid=someidhere',
headers: {'Content-Type': 'text/html'},
}
http.get(options, function(res) {
console.log("Got response: " + res.statusCode)
res.on("data", function(chunk) {
console.log(chunk)
})
}).on('error', function(e) {
console.log("Got error: " + e.message)
})
你可以使用cURL命令更新問題嗎? – Stewart
新增curl命令@Stewart – ikenator
如果不通過節點發送標題,會發生什麼? – Stewart