|
| 1 | +export async function POST(req: Request) { |
| 2 | + const body = await req.json(); // $ MISSING: Source |
| 3 | + |
| 4 | + new Response(body, {headers: { 'Content-Type': 'application/json' }}); // This is okay, since content type is set to application/json |
| 5 | + new Response(body, {headers: { 'Content-Type': 'text/html' }}); // $ MISSING: Alert |
| 6 | + |
| 7 | + const headers2 = new Headers(req.headers); |
| 8 | + headers2.append('Content-Type', 'application/json'); |
| 9 | + new Response(body, { headers: headers2 }); // This is okay, since content type is set to application/json |
| 10 | + |
| 11 | + const headers3 = new Headers(req.headers); |
| 12 | + headers3.append('Content-Type', 'text/html'); |
| 13 | + new Response(body, { headers: headers3 }); // $ MISSING: Alert |
| 14 | + |
| 15 | + const headers4 = new Headers({ |
| 16 | + ...Object.fromEntries(req.headers), |
| 17 | + 'Content-Type': 'application/json' |
| 18 | + }); |
| 19 | + new Response(body, { headers: headers4 }); // This is okay, since content type is set to application/json |
| 20 | + |
| 21 | + const headers5 = new Headers({ |
| 22 | + ...Object.fromEntries(req.headers), |
| 23 | + 'Content-Type': 'text/html' |
| 24 | + }); |
| 25 | + new Response(body, { headers: headers5 }); // $ MISSING: Alert |
| 26 | + |
| 27 | + const headers = new Headers(req.headers); |
| 28 | + headers.set('Content-Type', 'text/html'); |
| 29 | + return new Response(body, { headers }); // $ MISSING: Alert |
| 30 | +} |
0 commit comments