Comparison

net/http/server.lua @ 10326:cd1c73c2bdec

net.http.server: Explicitly convert number to string, avoiding implicit coercion
author Kim Alvefur <zash@zash.se>
date Sat, 12 Oct 2019 19:30:29 +0200
parent 10324:3f4c25425589
child 10392:7a95f27ac9d6
comparison
equal deleted inserted replaced
10325:f2bbad04cf64 10326:cd1c73c2bdec
312 response:done(); 312 response:done();
313 end 313 end
314 function _M.send_response(response, body) 314 function _M.send_response(response, body)
315 if response.finished then return; end 315 if response.finished then return; end
316 body = body or response.body or ""; 316 body = body or response.body or "";
317 response.headers.content_length = #body; 317 response.headers.content_length = ("%d"):format(#body);
318 if response.is_head_request then 318 if response.is_head_request then
319 return _M.send_head_response(response) 319 return _M.send_head_response(response)
320 end 320 end
321 local output = prepare_header(response); 321 local output = prepare_header(response);
322 t_insert(output, body); 322 t_insert(output, body);