[英]what is data type of {'Content-Type:':'text/plain'} in response.writeHead() method?
The common way to creating web server in node.js is something like this: response.writeHead(200,{'Content-Type':'text/plain'});
在node.js中创建Web服务器的常用方法如下:
response.writeHead(200,{'Content-Type':'text/plain'});
,but what is data type of {'Content-Type:':'text/plain'}
section? ,但是
{'Content-Type:':'text/plain'}
部分的数据类型是什么? an Object
? 一个
Object
? or a tuple
? 还是
tuple
? I have never seen anything like that before in Javascript. 我以前从未在Javascript中看到过类似的东西。
It is an anonymous object. 它是一个匿名对象。 Have you seen something simple like this:
您是否看到过类似以下的简单内容:
{x: 10}
Well it is the same thing except it has a '-' in the key name so the key has to be put in quotes. 好吧,除了密钥名称中带有“-”以外,它是一回事,因此必须将密钥置于引号中。 The object is using specific naming that corresponds with the standards for HTTP headers ( ref ).
该对象正在使用与HTTP标头( ref )的标准相对应的特定命名。
Text/plain is full text like .txt file. 文字/纯文字是.txt文件之类的全文。
In text/plain content, the HTML doesn't be parsed. 在文本/纯文本内容中,不会解析HTML。 If you write "
<b>Hi</b>
", you will see the same thing (" <b>Hi</b>
"). 如果您输入“
<b>Hi</b>
”,则会看到相同的内容(“ <b>Hi</b>
”)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.