emptygif
Basa: Basa Jawa

Kabeh basa lan framework

HTTP.jl Julia

Snippet Julia kanggo HTTP.jl sing mangsuli request menyang /pixel.gif nganggo empty GIF, sing didekode sepisan nalika startup.

HTTP.jl Julia

Instal
julia -e 'using Pkg; Pkg.add("HTTP")'
File
server.jl
Lakokake
julia server.jl
using Base64
using HTTP

const GIF = base64decode("R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==")
const HEADERS = ["Content-Type" => "image/gif", "Cache-Control" => "no-store"]

router = HTTP.Router()
HTTP.register!(router, "GET", "/pixel.gif", _ -> HTTP.Response(200, HEADERS, GIF))

HTTP.serve(router, "0.0.0.0", 8080)

Snippet iki wis dilakokake lan byte asile wis dibandhingake.

Priksa

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

Situs resmi: HTTP.jl

Liyane ing Julia