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

So a check for body being a string here[1] will do.

[1] http://github.com/keplerproject/wsapi/blob/master/src/wsapi/response.lua#L69 <http://github.com/keplerproject/wsapi/blob/master/src/wsapi/response.lua#L69>


Regards,
Ignacio



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

Reply via email to