emptygif
Idioma: Español

Todos los lenguajes y frameworks

Oxygen.jl Julia

Un fragmento en Julia para Oxygen.jl que responde a las peticiones a /pixel.gif con el GIF vacío, decodificado una sola vez al arrancar.

Oxygen.jl Julia

Instalar
julia -e 'using Pkg; Pkg.add(["Oxygen", "HTTP"])'
Archivo
server.jl
Ejecutar
julia server.jl
using Base64
using HTTP
using Oxygen

const GIF = base64decode("R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==")

@get "/pixel.gif" function (req::HTTP.Request)
    HTTP.Response(200, ["Content-Type" => "image/gif", "Cache-Control" => "no-store"], GIF)
end

serve(host = "0.0.0.0", port = 8080)

Ejecutamos este fragmento y comparamos los bytes que devolvió.

Comprobar

curl -sI http://localhost:8080/pixel.gif

Sitio oficial: Oxygen.jl

Más en Julia