Function: verb--response-header-line-string

verb--response-header-line-string is a byte-compiled function defined in verb.el.

Signature

(verb--response-header-line-string &rest ARGS)

Implementations

(verb--response-header-line-string (RESPONSE verb-response)) in `verb.el'.

Return a short description of an HTTP RESPONSE's properties.

Source Code

;; Defined in /nix/store/8jnfn8w2mxcxbr2crbklcnija9m0zlkq-emacs-packages-deps/share/emacs/site-lisp/elpa/verb-20260818.1921/verb.el
(cl-defmethod verb--response-header-line-string ((response verb-response))
  "Return a short description of an HTTP RESPONSE's properties."
  (let ((status-line (oref response status))
        (elapsed (oref response duration))
        (headers (oref response headers))
        (bytes (oref response body-bytes))
        (path (car (url-path-and-query (oref (oref response request) url)))))
    (concat
     (if-let ((face (verb--status-code-face (or status-line "")))
              (parts (split-string status-line " " t))
              (rest (string-join (cdr parts) " ")))
         (concat (car parts) " | " (propertize rest 'face face))
       (or status-line "No Response"))
     " | "
     (format "%.4gs" elapsed)
     (let ((content-type (or (car (verb--headers-content-type headers))
                             "-")))
       (format " | %s" content-type))
     (let* ((content-length (cdr (assoc-string "Content-Length"
                                               headers t)))
            (value (if content-length
                       (string-to-number content-length)
                     bytes)))
       (format " | %s byte%s"
               (file-size-human-readable value)
               (if (= value 1) "" "s")))
     (when (not (string-empty-p path))
       (format " | %s" path)))))