pegasus.lua icon indicating copy to clipboard operation
pegasus.lua copied to clipboard

May be a bug in handler.lua

Open lingbl opened this issue 2 years ago • 1 comments

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

lingbl avatar May 03 '23 06:05 lingbl

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.

Tieske avatar May 03 '23 10:05 Tieske