Todos los lenguajes y frameworks
AWS Lambda (Node.js) JavaScript
Un fragmento en JavaScript para AWS Lambda (Node.js) que responde a las peticiones a /pixel.gif con el GIF vacío, decodificado una sola vez al arrancar.
AWS Lambda (Node.js) JavaScript
// index.mjs - behind an API Gateway HTTP API route "GET /pixel.gif" or a function URL.
// Binary bodies travel base64-encoded, so the GIF stays in base64 here.
const GIF_BASE64 = 'R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==';
export const handler = async () => ({
statusCode: 200,
headers: { 'Content-Type': 'image/gif', 'Cache-Control': 'no-store' },
body: GIF_BASE64,
isBase64Encoded: true,
});
Ejecutamos este fragmento y comparamos los bytes que devolvió.
Comprobar
curl -sI http://localhost:8080/pixel.gif
Sitio oficial: AWS Lambda (Node.js)