Function: verb--prepare-http-headers

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

Signature

(verb--prepare-http-headers HEADERS)

Documentation

Prepare alist HEADERS of HTTP headers to be used on a request.

Add/modify/remove the following headers if they are not already present or are incomplete:

Accept:
  Remove header from list (will be set via url-mime-accept-string).

Use verb--to-ascii to ensure all added text is unibyte. Return a new alist, does not modify HEADERS.

Source Code

;; Defined in /nix/store/8jnfn8w2mxcxbr2crbklcnija9m0zlkq-emacs-packages-deps/share/emacs/site-lisp/elpa/verb-20260818.1921/verb.el
(defun verb--prepare-http-headers (headers)
  "Prepare alist HEADERS of HTTP headers to be used on a request.
Add/modify/remove the following headers if they are not already
present or are incomplete:

Accept:
  Remove header from list (will be set via `url-mime-accept-string').

Use `verb--to-ascii' to ensure all added text is unibyte.
Return a new alist, does not modify HEADERS."
  (let* ((headers (copy-alist headers))
         (accept (assoc-string "Accept" headers t)))
    ;; Accept header:
    (when accept
      (setq headers (cl-delete "Accept" headers
                               :key #'car
                               :test #'verb-util--string=)))
    ;; Encode all text to `us-ascii'.
    (mapcar (lambda (e)
              (cons (verb--to-ascii (car e))
                    (verb--to-ascii (cdr e))))
            headers)))