emptygif
Lingua: Italiano

Tutti i linguaggi e framework

Oxygen.jl Julia

Uno snippet Julia per Oxygen.jl che risponde alle richieste a /pixel.gif con la GIF vuota, decodificata una sola volta all'avvio.

Oxygen.jl Julia

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

Abbiamo eseguito questo snippet e confrontato i byte che ha restituito.

Verifica

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

Sito ufficiale: Oxygen.jl

Altro in Julia