Todos los lenguajes y frameworks
PostgreSQL SQL
Un fragmento en SQL para PostgreSQL que responde a las peticiones a /pixel.gif con el GIF vacío, decodificado una sola vez al arrancar.
PostgreSQL SQL
CREATE TABLE IF NOT EXISTS assets (
name text PRIMARY KEY,
content_type text NOT NULL,
body bytea NOT NULL
);
INSERT INTO assets (name, content_type, body)
VALUES ('pixel.gif', 'image/gif', decode('R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==', 'base64'))
ON CONFLICT (name) DO UPDATE SET body = EXCLUDED.body;
Ejecutamos este fragmento y comparamos los bytes que devolvió.