cookie.go 438 B

1234567891011121314151617
  1. // Copyright 2018 Frédéric Guillot. All rights reserved.
  2. // Use of this source code is governed by the Apache 2.0
  3. // license that can be found in the LICENSE file.
  4. package request // import "miniflux.app/http/request"
  5. import "net/http"
  6. // CookieValue returns the cookie value.
  7. func CookieValue(r *http.Request, name string) string {
  8. cookie, err := r.Cookie(name)
  9. if err == http.ErrNoCookie {
  10. return ""
  11. }
  12. return cookie.Value
  13. }