【发布时间】:2011-05-31 14:05:32
【问题描述】:
现在作为示例,我收到一个响应,其中部分键/值作为 javascript 对象:
status: '200 OK',
'content-encoding': 'gzip'
我可以通过以下方式轻松读出并记录状态消息:headers.status 但是当我尝试记录内容编码(在这种特殊情况下我需要)时,它会出错:
headers.'content-encoding' <- obviously the quotes it doesn't like
headers.content-encoding <- obviously the '-' it doesn't like
我想如何获取/读取/记录它的内容编码值?
你好,
m0rph3v5
【问题讨论】:
标签: javascript json variables http-headers node.js