Variable: verb-content-type-handlers

verb-content-type-handlers is a customizable variable defined in verb.el.

Value

(("text/html" html-mode) ("\\(application\\|text\\)/xml" xml-mode)
 ("application/xhtml\\+xml" xml-mode)
 ("application/\\(json\\|vscode-jsonrpc\\)" verb-handler-json)
 ("application/javascript" js-mode) ("application/css" css-mode)
 ("text/plain" text-mode) ("application/pdf" doc-view-mode t)
 ("image/png" image-mode t) ("image/svg\\+xml" image-mode t)
 ("image/x-windows-bmp" image-mode t) ("image/gif" image-mode t)
 ("image/jpe?g" image-mode t))

Documentation

List of content type handlers.

Handlers are functions to be called without any arguments. There are two types of handlers: text and binary.

Text handlers are called after the text contents of the response have been decoded into a multibyte buffer (with that buffer as the current buffer).

Binary handlers, on the other hand, are called after the binary contents of the response have been inserted into a unibyte buffer
(with that buffer as the current buffer).

Both handler types should prepare the contents of the response buffer, so that the user can then access or modify the information received in a convenient way.

Entries of the alist must have the form (CONTENT-TYPE HANDLER BIN?). CONTENT-TYPE must be a regexp which can match any number of valid content types, or a string containing a content type. HANDLER must be a function that takes no arguments. BIN?, if present, must be t, in order to indicate that this handler is binary instead of text.

To choose a handler, Verb will try to match the received content type with each CONTENT-TYPE in the alist (sequentially) using string-match-p. The handler for the first CONTENT-TYPE to match will be used.

Source Code

;; Defined in /nix/store/8jnfn8w2mxcxbr2crbklcnija9m0zlkq-emacs-packages-deps/share/emacs/site-lisp/elpa/verb-20260818.1921/verb.el
(defcustom verb-content-type-handlers
  '(;; Text handlers
    ("text/html" html-mode)
    ("\\(application\\|text\\)/xml" xml-mode)
    ("application/xhtml\\+xml" xml-mode)
    ("application/\\(json\\|vscode-jsonrpc\\)" verb-handler-json)
    ("application/javascript" js-mode)
    ("application/css" css-mode)
    ("text/plain" text-mode)
    ;; Binary handlers
    ("application/pdf" doc-view-mode t)
    ("image/png" image-mode t)
    ("image/svg\\+xml" image-mode t)
    ("image/x-windows-bmp" image-mode t)
    ("image/gif" image-mode t)
    ("image/jpe?g" image-mode t))
  "List of content type handlers.
Handlers are functions to be called without any arguments.  There are
two types of handlers: text and binary.

Text handlers are called after the text contents of the response have
been decoded into a multibyte buffer (with that buffer as the current
buffer).

Binary handlers, on the other hand, are called after the binary
contents of the response have been inserted into a unibyte buffer
\(with that buffer as the current buffer).

Both handler types should prepare the contents of the response buffer,
so that the user can then access or modify the information received in
a convenient way.

Entries of the alist must have the form (CONTENT-TYPE HANDLER BIN?).
CONTENT-TYPE must be a regexp which can match any number of valid
content types, or a string containing a content type.  HANDLER must be
a function that takes no arguments.  BIN?, if present, must be t, in
order to indicate that this handler is binary instead of text.

To choose a handler, Verb will try to match the received content type
with each CONTENT-TYPE in the alist (sequentially) using
`string-match-p'.  The handler for the first CONTENT-TYPE to match
will be used."
  :type '(repeat (list regexp function
                       (choice (const :tag "Binary" t)
                               (const :tag "Text" nil)))))