emptygif
Language: English

All languages and frameworks

Oxygen.jl Julia

A Julia snippet for Oxygen.jl that answers requests for /pixel.gif with the empty GIF, decoded once at startup.

Oxygen.jl Julia

Install
julia -e 'using Pkg; Pkg.add(["Oxygen", "HTTP"])'
File
server.jl
Run
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)

We ran this snippet and compared the bytes it returned.

Check it

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

Official site: Oxygen.jl

More in Julia