简体   繁体   English

使用CoffeeScript检查HTTP请求中的内容类型

[英]check content type in http request using CoffeeScript

I dont know how to extract the "Content-type" header from de request 我不知道如何从请求中提取“ Content-type”标头

server = http.createServer (req, res) -> 
  #TODO req.headers.?

Any idea? 任何想法?

I think it's just req.headers['content-type'] . 我认为这只是req.headers['content-type'] It can be undefined though so be careful. 它可以是undefined但是要小心。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM