tkf / emacs-request

Request.el -- Easy HTTP request for Emacs Lisp
http://tkf.github.com/emacs-request/
GNU General Public License v3.0
629 stars 93 forks source link

[Question] Idiomatic processing of GET #78

Closed juergenhoetzel closed 5 years ago

juergenhoetzel commented 7 years ago

First: Thanks for this nice library :+1:

There are many useful examples on this page. But all examples do handle the response in a imperative/side-effect way (message output).

I would like to do something like this:

(request
 "http://example.host/add"
 :params '(("a" . 1) ("b" . 2))
 :parser 'json-read)

Eval result is:

3

Is this possible?

titaniumbones commented 5 years ago

I don't entirely undertand your question, but if you are asking for access to the response data, then perhaps you want something like this?

(let* ((thisrequest elisp
    (request
      "http://example.host/add"
      :params '(("a" . 1) ("b" . 2))
      :parser 'json-read) ))
    (data (request-response-data thisrequest))
    (messate "%s" data))

I hope to update the documentation when I have time!

titaniumbones commented 5 years ago

fixed as of 8a6c15763b300b46c5179bd02e26af28e83288d3