Function: verb--request-spec-post-process
verb--request-spec-post-process is a natively compiled function
defined in verb.el.
Signature
(verb--request-spec-post-process RS)
Documentation
Validate and prepare request spec RS to be used.
The following checks/preparations are run:
1) Check if verb-base-headers needs to be applied.
2) Apply request mapping function, if one was specified.
3) Read any response mapping function, if one was specified.
4) Run validations with verb-request-spec-validate.
After that, return RS.
Source Code
;; Defined in /nix/store/8jnfn8w2mxcxbr2crbklcnija9m0zlkq-emacs-packages-deps/share/emacs/site-lisp/elpa/verb-20260818.1921/verb.el
(defun verb--request-spec-post-process (rs)
"Validate and prepare request spec RS to be used.
The following checks/preparations are run:
1) Check if `verb-base-headers' needs to be applied.
2) Apply request mapping function, if one was specified.
3) Read any response mapping function, if one was specified.
4) Run validations with `verb-request-spec-validate'.
After that, return RS."
;; Use `verb-base-headers' if necessary.
(when verb-base-headers
(setq rs (verb-request-spec-override
(verb-request-spec :headers verb-base-headers
:url (verb--request-spec-url-origin rs))
rs)))
;; Apply the request mapping function, if present.
(when-let ((form (verb--request-spec-metadata-get rs "map-request"))
(fn (verb--try-read-fn-form form)))
(if (functionp fn)
(setq rs (funcall fn rs))
(user-error "`%s' is not a valid request mapping function" fn))
(unless (verb--object-of-class-p rs 'verb-request-spec)
(user-error (concat "Request mapping function `%s' must return a "
"`verb-request-spec' value")
fn)))
;; Read the response mapping function, if present.
(when-let ((form (verb--request-spec-metadata-get rs "map-response"))
(fn (verb--try-read-fn-form form)))
(if (functionp fn)
(verb--request-spec-metadata-set rs "map-response" fn)
(user-error "`%s' is not a valid response mapping function" fn)))
;; Validate and return.
(verb-request-spec-validate rs))