Explicitly make GET request to /config/data from khoj.el:khoj-server-configure method

Previously global state of `url-request-method' would affect the
kind of request made to api/config/data API endpoint as it wasn't
being explicitly being set before calling the API endpoint

This was done with the assumption that the default value of GET for
url-request-method wouldn't change globally

But in some cases, experientially, it can get changed. This was
resulting in khoj.el load failing as POST request was being made
instead which would throw error
This commit is contained in:
Debanjum Singh Solanky 2023-10-12 20:40:39 -07:00
parent 292f0420ad
commit bea196aa30

View file

@ -389,6 +389,7 @@ CONFIG is json obtained from Khoj config API."
"Configure the Khoj server for search and chat."
(interactive)
(let* ((org-directory-regexes (or (mapcar (lambda (dir) (format "%s/**/*.org" dir)) khoj-org-directories) json-null))
(url-request-method "GET")
(current-config
(with-temp-buffer
(url-insert-file-contents (format "%s/api/config/data" khoj-server-url))
@ -573,9 +574,9 @@ CONFIG is json obtained from Khoj config API."
(run-with-timer 60 khoj-index-interval 'khoj--server-index-files))
;; -----------------------------------------------
;; Extract and Render Entries of each Content Type
;; -----------------------------------------------
;; -------------------------------------------
;; Render Response from Khoj server for Emacs
;; -------------------------------------------
(defun khoj--extract-entries-as-markdown (json-response query)
"Convert JSON-RESPONSE, QUERY from API to markdown entries."