emptygif
Wika: Filipino

Lahat ng language at framework

HTTP.jl Julia

Isang Julia snippet para sa HTTP.jl na sumasagot sa mga request sa /pixel.gif gamit ang empty GIF, na isang beses lang dine-decode sa startup.

HTTP.jl Julia

I-install
julia -e 'using Pkg; Pkg.add("HTTP")'
File
server.jl
Patakbuhin
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)

Pinatakbo namin ang snippet na ito at ikinumpara ang mga byte na ibinalik nito.

Suriin

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

Opisyal na site: HTTP.jl

Iba pa sa Julia