import http from 'node:http'; import {pathToFileURL} from 'node:url'; export const cases={ '/before/removed':[200,'Page not found'], '/after/removed':[404,'Page not found'], '/after/moved':[301,'Moved','/after/replacement'], '/after/replacement':[200,'Product guide'], '/after/live':[200,'Shipping guide'], }; export function createFixture(port=8080){ return http.createServer((request,response)=>{ const [status,title,location]=cases[request.url]??[404,'Page not found']; response.writeHead(status,{'Content-Type':'text/html; charset=utf-8',...(location?{Location:location}:{})}); response.end('