cookie.go 441 B

12345678910111213141516
  1. // SPDX-FileCopyrightText: Copyright The Miniflux Authors. All rights reserved.
  2. // SPDX-License-Identifier: Apache-2.0
  3. package request // import "miniflux.app/v2/internal/http/request"
  4. import "net/http"
  5. // CookieValue returns the named cookie value, or an empty string if the cookie is missing.
  6. func CookieValue(r *http.Request, name string) string {
  7. cookie, err := r.Cookie(name)
  8. if err != nil {
  9. return ""
  10. }
  11. return cookie.Value
  12. }