From bea196aa30f91baa8cccb7e00f032e021c9ab000 Mon Sep 17 00:00:00 2001 From: Debanjum Singh Solanky Date: Thu, 12 Oct 2023 20:40:39 -0700 Subject: [PATCH] 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 --- src/interface/emacs/khoj.el | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/interface/emacs/khoj.el b/src/interface/emacs/khoj.el index 44c52601..cccdc12c 100644 --- a/src/interface/emacs/khoj.el +++ b/src/interface/emacs/khoj.el @@ -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."