emptygif
语言: 简体中文

所有语言和框架

plumber R

一个用于 plumber 的 R 代码片段,以空 GIF 响应对 /pixel.gif 的请求,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