HTTP.jl Julia
Đoạn mã Julia cho HTTP.jl, trả lời các yêu cầu tới /pixel.gif bằng GIF rỗng, được giải mã một lần khi khởi động.
HTTP.jl Julia
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)
Chúng tôi đã chạy đoạn mã này và so sánh các byte nó trả về.
Kiểm tra
curl -sI http://localhost:8080/pixel.gif