Function: verb-headers-get

verb-headers-get is a natively compiled function defined in verb.el.

Signature

(verb-headers-get DATA NAME &optional NOERROR)

Documentation

Return value for HTTP header under NAME in DATA.

DATA must be one of the following:
- An instance of verb-response(var)/verb-response(fun), which will contain headers as an
  alist described below.
- An alist of (KEY . VALUE) elements.
NAME and KEY will be compared ignoring case. If no value is present under NAME, signal an error (unless NOERROR is non-nil, in which case return nil).

Source Code

;; Defined in /nix/store/8jnfn8w2mxcxbr2crbklcnija9m0zlkq-emacs-packages-deps/share/emacs/site-lisp/elpa/verb-20260818.1921/verb.el
(defun verb-headers-get (data name &optional noerror)
  "Return value for HTTP header under NAME in DATA.
DATA must be one of the following:
- An instance of `verb-response', which will contain headers as an
  alist described below.
- An alist of (KEY . VALUE) elements.
NAME and KEY will be compared ignoring case.  If no value is present
under NAME, signal an error (unless NOERROR is non-nil, in which case
return nil)."
  (when (verb--object-of-class-p data 'verb-response)
    (setq data (oref data headers)))
  (if-let ((val (assoc-string name data t)))
      (cdr val)
    (unless noerror
      (user-error "No value found for HTTP header \"%s\"" name))))