alphapapa / alphapapa/elexandria

Problem with url-with-retrieve-async

未關閉
#2 8 則留言 0 個 reaction 已指派 1 人 已被 @alphapapa 認領 在 GitHub 檢視
主要語言
Emacs Lisp
星號
13
分支
0
PR 合併指標
30 天內沒有已合併 PR

描述

I'm trying to see if I could [replace request.el with elexandria](https://gitlab.petton.fr/elcouch/libelcouch/tree/elexandria) but I failed. Current code is:

```emacs
(cl-defgeneric libelcouch-entity-list (entity function)
"Evaluate function with the children of ENTITY as parameter."
(request
(url-encode-url (libelcouch--entity-children-url entity))
:timeout libelcouch-timeout
:headers '(("Content-Type" . "application/json")
("Accept" . "application/json"))
:parser 'json-read
:success (cl-function
(lambda (&key data &allow-other-keys)
(let* ((children (libelcouch--entity-create-children-from-json entity data)))
(funcall function children))))
:error #'libelcouch--request-error)
nil)
```

while new code is

```emacs
(cl-defgeneric libelcouch-entity-list (entity function)
"Evaluate function with the children of ENTITY as parameter."
(url-with-retrieve-async
(url-encode-url (libelcouch--entity-children-url entity))
:timeout libelcouch-timeout
:extra-headers '(("Content-Type" . "application/json")
("Accept" . "application/json"))
:parser 'json-read
:success (cl-function
(lambda (&key data &allow-other-keys)
(let* ((children (libelcouch--entity-create-children-from-json entity data)))
(funcall function children))))
:error #'libelcouch--request-error)
nil)
```

The first one works fine but the second doesn't seem to do anything beyond "Contacting host: localhost:5984". The only things I changed are the function name and the `:headers` key (changed to `:extra-headers`. Is there anything else I should have changed?

貢獻指南

這個儲存庫沒有索引到貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。