美文网首页
http模块

http模块

作者: coffee1949 | 来源:发表于2019-06-16 12:04 被阅读0次

    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

    相关文章

      网友评论

          本文标题:http模块

          本文链接:https://www.haomeiwen.com/subject/oakifctx.html