response对象
response.setHeader(key, value)
response.writeHead(200, {'Content-Type': 'text/plain'})
response.write("Hello World")
response.end()
setHeader:
request.setHeader('Content-Type', 'application/json');
request.setHeader('Content-Type', 'text/plain');
request.setHeader('Content-Type', 'text/html');
// 注意下面中间的值用分号;隔开
request.setHeader('Content-Type', 'text/html;charset=utf-8');
request.setHeader('Cookie', ['type=ninja', 'language=javascript']);
Content-Type:http://tool.oschina.net/commons
text/plain
text/html
application/json
application/x-www-form-urlencoded
7
网友评论