they can eat the leaves at the top of the trees

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了they can eat the leaves at the top of the trees相关的知识,希望对你有一定的参考价值。

根据句子意思,写出所指动物的单词.
1.They are very tall.They walk slowly.They have long legs andlong necks.They can eat the leaves at the top of trees.
2.They do not have legs but they can move fast.They can open their mouths really wide.they can eat big animals.

参考技术A 你好,很高兴回答你的问题

①giraffe 长颈鹿

②snake 蛇

Error: Can't set headers after they are sent.

问题描述:

系统:Windows 7 x64

Node.js版本:版本是:v4.2.4 LTS

安装过程参考:《Node.js入门》Windows 7下Node.js Web开发环境搭建笔记

一段后端模拟HTTP请求的代码出现以下错误:Error: Can't set headers after they are sent.

如下图:

相关代码:

app.get('/trans', function (req, res) {
	var body = '';
	//这是需要提交的数据
	params = { 'source':'en', 'target':'es', 'text':'hello' }
	var data = qs.stringify(params);
	
	http.get("https://gateway.watsonplatform.net/language-translation/api/v2/translate?" + data, function(gres) { 
		console.log("Got response: " + gres); 
		gres.on('data',function(d){
			body += d;
		 }).on('end', function(){
		  //console.log(gres.headers);
		  console.log(body);
		  res.send(body);
		 });
	}).on('error', function(e) { 
		console.log("Got error: " + e.message); 
	});
	res.send(body);
});
问题原因:

出现此错误的原因是因为

http.get
中的响应代码是异步的,

但在它响应之前,也就是最下面的一句“res.send(body);”已经把响应流关闭了。

解决方法:

将最下面的一句“res.send(body);”注释了就OK了。

以上是关于they can eat the leaves at the top of the trees的主要内容,如果未能解决你的问题,请参考以下文章

Error: Can't set headers after they are sent.

UVA 699 The Falling Leaves

Cracking the Code: How Kids Can Write Their Own Video Game

eclipase项目导入错误Some projects cannot be imported because they already exist in the workspace

*eclipse 中添加工程 Some projects cannot be imported because they already exist in the workspace

Parents Leave Baby Inside A Locker Before Going To The Pool