Skip to content

Example does not work without curl #175

Description

@egh

Versions:
Ubuntu 18.04
GNU Emacs 26.3 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.22.30) of 2019-09-16

Steps to reproduce:

  1. Retrieve request.el: wget https://raw.githubusercontent.com/tkf/emacs-request/master/request.el
  2. Open emacs -Q
  3. M-x load-library json
  4. Open request.el and eval buffer
  5. Eval: (setq request-backend 'url-retrieve)
  6. Eval:
(request
 "http://httpbin.org/put"
 :type "PUT"
 :data (json-encode '(("key" . "値1") ("key2" . "値2")))
 :headers '(("Content-Type" . "application/json"))
 :parser 'json-read
 :encoding 'utf-8
 :success (cl-function
           (lambda (&key data &allow-other-keys)
             (message "I sent: %S" (assoc-default 'json data)))))

Expected result: Message I sent: ((key . "値1") (key2 . "値2"))

Actual result: error:

Contacting host: httpbin.org:80
#s(request-response nil nil nil nil nil "http://httpbin.org/put" nil (:type "PUT" :data "{\"key\":\"値1\",\"key2\":\"値2\"}" :headers (("Content-Type" . "application/json")) :parser json-read :encoding utf-8 :success (lambda (&rest --cl-rest--) "

(fn &key DATA &allow-other-keys)" (let* ... ...)) ...) #<buffer  *http httpbin.org:80*> nil nil ...)
url-http-create-request: Multibyte text in HTTP request: PUT /put HTTP/1.1
MIME-Version: 1.0
Connection: keep-alive
Extension: Security/Digest Security/SSL
Host: httpbin.org
Accept-encoding: gzip
Accept: */*
User-Agent: URL/Emacs Emacs/26.3 (X11; x86_64-pc-linux-gnu)
Content-Type: application/json
Content-length: 24

{"key":"値1","key2":"値2"}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions