+ # Size of the body
+ var len = body.bytelen
+
+ # Size of included files
+ for path in files do
+ # TODO handle these error cases elsewhere, an error here will result in an invalid response
+ if not path.file_exists then
+ print_error "File does not exists at '{path}'"
+ continue
+ end
+
+ var stat = path.file_stat
+ if stat == null then
+ print_error "Failed to stat file at '{path}'"
+ continue
+ end
+
+ len += stat.size
+ end
+
+ # Set header
+ header["Content-Length"] = len.to_s