emptygif
언어: 한국어

모든 언어 및 프레임워크

plumber R

/pixel.gif 요청에 빈 GIF로 응답하는 plumber용 R 스니펫입니다. GIF는 시작할 때 한 번만 디코딩합니다.

plumber R

설치
install.packages("plumber")
파일
plumber.R
실행
Rscript -e 'plumber::pr_run(plumber::pr("plumber.R"), port = 8080)'
# plumber.R
gif <- jsonlite::base64_dec("R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==")

#* @get /pixel.gif
#* @serializer contentType list(type = "image/gif")
function(res) {
  res$setHeader("Cache-Control", "no-store")
  gif
}

이 스니펫은 실행해 보고, 반환된 바이트를 비교했습니다.

확인

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

공식 사이트: plumber