Function: verb-request-spec-validate

verb-request-spec-validate is a byte-compiled function defined in verb.el.

Signature

(verb-request-spec-validate &rest ARGS)

Implementations

(verb-request-spec-validate (RS verb-request-spec)) in `verb.el'.

Run validations on request spec RS and return it. If a validation does not pass, signal `user-error'.

Source Code

;; Defined in /nix/store/8jnfn8w2mxcxbr2crbklcnija9m0zlkq-emacs-packages-deps/share/emacs/site-lisp/elpa/verb-20260818.1921/verb.el
(cl-defmethod verb-request-spec-validate ((rs verb-request-spec))
  "Run validations on request spec RS and return it.
If a validation does not pass, signal `user-error'."
  (unless (oref rs method)
    (user-error "%s" (concat "No HTTP method specified\nMake sure you specify "
                             "a concrete HTTP method (e.g. GET, not "
                             verb--template-keyword
                             ") in the heading hierarchy")))
  (let ((url (oref rs url)))
    (unless url
      (user-error "%s" (concat "No URL specified\nMake sure you specify "
                               "a nonempty URL in the heading hierarchy")))
    (unless (url-host url)
      (user-error "%s" (concat "URL has no scheme or host defined\n"
                               "Make sure you specify a scheme and host "
                               "(e.g. \"https://github.com\") in the "
                               "heading hierarchy"))))
  (when (and (null (car (verb--headers-content-type (oref rs headers))))
             (string= (oref rs method) "QUERY"))
    (user-error "%s" "Missing \"Content-Type\" header for QUERY request"))
  rs)