0

I have some CoffeeScript code that reads in data from an http stream.

https = require 'https'

export.commScore = (IP,from,file)->

  options =
    path: "ctasd/ClassifyMessage_File",
    host: "127.0.0.1",
    method: "POST",
    port: "8088",
    headers:
      "Accept-Language":"en-us",
      "Accept":"*/*",
      "User-Agent":"Commtouch HTTP Client",
      "X-CTCH-PVer": "0000001",
      "X-CTCH-SenderIP": IP,
      "X-CTCH-MailFrom": from,
      "X-CTCH-FileName": file

  stream = http.request(options,(response)->)

Every time I try to compile this code I get an error that says:

 error: unexpected ,
path: "ctasd/ClassifyMessage_File",
                             ^

I have checked CoffeScripts documentation to make sure I was creating this object correctly and Node's http API to make sure I was setting up the stream correctly and everything checked out. I've also tried consulting the all knowing Google to see if anybody had any similia issues but couldn't find anything. Why does CoffeeScript refuse to compile my code?

4

1 回答 1

0

Arron Dufour 在评论中的评论中回答了这个问题。结果编译器不喜欢我的文本编辑器的自动缩进。仔细检查并手动间隔所有内容可以解决问题。

于 2013-07-25T21:30:38.467 回答