how to get post content with groovy listening on a port?

Posted by Amir Raminfar on Stack Overflow See other posts from Stack Overflow or by Amir Raminfar
Published on 2010-12-31T18:08:04Z Indexed on 2011/01/02 6:53 UTC
Read the original article Hit count: 218

Filed under:
|

I wrote the following simple groovy code that handles a request.

if (init)
  data = ""

if (line.size() > 0) {
  data += "--> " + line + "\n"
} else {
  println "HTTP/1.1 200 OK\n"
  println data
  println "----\n"
  return "success"
}

I then run it by doing groovy -l 8888 ServerTest.groovy However, it doesn't seem to print any POST data. I am testing it by doing curl -d "d=test" http://localhost:8888/ Does anybody know how to get that data in groovy?

© Stack Overflow or respective owner

Related posts about groovy

Related posts about cli