2009/11/10 Ignacio Burgueño <[email protected]>

> Hi. In certain situations I need to return short text responses, so I do:
>
> local response = wsapi.response.new(200, { ["Content-Type"]= "text/plain"
> }, coroutine.wrap(function() return "Everything went smooth!" end) )
> response:finish()
>
> That feels way too verbose. I'd like to write:
>
> local response = wsapi.response.new(200, { ["Content-Type"]= "text/plain"
> }, "Everything went smooth!" )
> response:finish()
>
> Why wsapi forces me to pass a coroutine all the time? Being wsapi.response
> a helper module, a little help from its part wouldn't hurt :D
>
>
----
local res = wsapi.reponse.new()
res.headers["Content-Type"] = "text/plain"
res:write("Everything went smooth!")
return res:finish()
----

What is wrong with that? :-)

--
Fabio Mascarenhas
_______________________________________________
Kepler-Project mailing list
[email protected]
http://lists.luaforge.net/cgi-bin/mailman/listinfo/kepler-project
http://www.keplerproject.org/

Reply via email to