Function: verb--override-url-paths

verb--override-url-paths is a natively compiled function defined in verb.el.

Signature

(verb--override-url-paths ORIGINAL OTHER)

Documentation

Override URL path (and query string) ORIGINAL with OTHER.

ORIGINAL and OTHER have the form (PATH . QUERY). Work using the rules described in verb-request-spec-override.

Source Code

;; Defined in /nix/store/8jnfn8w2mxcxbr2crbklcnija9m0zlkq-emacs-packages-deps/share/emacs/site-lisp/elpa/verb-20260818.1921/verb.el
(defun verb--override-url-paths (original other)
  "Override URL path (and query string) ORIGINAL with OTHER.
ORIGINAL and OTHER have the form (PATH . QUERY).  Work using the rules
described in `verb-request-spec-override'."
  (let* ((original-path (car original))
         (original-query (cdr original))
         (other-path (car other))
         (other-query (cdr other))
         (paths (concat original-path other-path))
         (queries (verb--url-query-alist-to-string
                   (verb--override-url-queries
                    (verb--url-query-string-to-alist original-query)
                    (verb--url-query-string-to-alist other-query)))))
    ;; If after joining two both paths the result path starts with //,
    ;; remove one of the slashes (this may happen often because we
    ;; sometimes add slashes in `verb--clean-url').
    (concat (if (string-prefix-p "//" paths)
                (substring paths 1 nil)
              paths)
            (unless (string-empty-p (or queries ""))
              ;; If query string is present and path is empty,
              ;; set / as the path (see `verb--clean-url').
              (concat (when (string-empty-p paths) "/")
                      "?"
                      queries)))))