pegasus.lua
pegasus.lua copied to clipboard
May be a bug in handler.lua
code in handler.lua:
if self.callback then response:statusCode(200) response.headers = {} -- response._headers = {} ??????????????????????????? response:addHeader('Content-Type', 'text/html')
self.callback(request, response)
end
If the code before it (while trying to serve a file), had already set some headers before it failed for some reason, then the headers get cleared. This makes sense to me.
Though I agree that the mixing of file handling and callbacks is not very clean, can could be improved upon, which would also fix your concern.