NoStore

设置HTTP响应头的Cache-Control: no-store,用于不希望客户端保存的请求,如验证码等一次性请求。

Example

  1. package main
  2. import (
  3. "github.com/vicanso/elton"
  4. "github.com/vicanso/elton/middleware"
  5. )
  6. func main() {
  7. e := elton.New()
  8. e.Use(middleware.NewDefaultResponder())
  9. e.GET("/", func(c *elton.Context) (err error) {
  10. c.NoStore()
  11. c.Body = "Hello, World!"
  12. return
  13. })
  14. err := e.ListenAndServe(":3000")
  15. if err != nil {
  16. panic(err)
  17. }
  18. }