file_link_header.sjs (595B)
1 "use strict"; 2 3 function handleRequest(request, response) { 4 // write to raw socket 5 response.seizePower(); 6 let body = `<!DOCTYPE html> 7 <html> 8 <head> 9 <link rel="preconnect" href="https://localhost"> 10 </head> 11 <body> 12 <h1>Test rel=preconnect<h1> 13 </body> 14 </html>`; 15 16 response.write("HTTP/1.1 200 OK\r\n"); 17 response.write("Content-Type: text/html;charset=utf-8\r\n"); 18 response.write("Cache-Control: no-cache\r\n"); 19 response.write(`Content-Length: ${body.length}\r\n`); 20 response.write("\r\n"); 21 response.write(body); 22 23 response.finish(); 24 }