Fiber Go
/pixel.gif 요청에 빈 GIF로 응답하는 Fiber용 Go 스니펫입니다. GIF는 시작할 때 한 번만 디코딩합니다.
Fiber Go
package main
import (
"encoding/base64"
"log"
"github.com/gofiber/fiber/v3"
)
var gif, _ = base64.StdEncoding.DecodeString("R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==")
func main() {
app := fiber.New()
app.Get("/pixel.gif", func(c fiber.Ctx) error {
c.Set("Cache-Control", "no-store")
return c.Type("gif").Send(gif)
})
log.Fatal(app.Listen(":8080"))
}
이 스니펫은 실행해 보고, 반환된 바이트를 비교했습니다.
확인
curl -sI http://localhost:8080/pixel.gif