gregsexton / httprepl.el

An HTTP REPL for Emacs
130 stars 3 forks source link

json content type #6

Closed nevetS closed 9 years ago

nevetS commented 9 years ago

I see the Httprepl Content Type Alist

It looks like "application/json" maps to js, which opens it up in js-mode on C-c C-c.

I'd like for the response to open up in json-mode.

Changing the mapping from "js" to "json" doesn't work. I'm not sure what else to try.

I'd also like for the headers to be stripped on C-c C-c. Is there a configuration parameter for that?

nevetS commented 9 years ago

To answer my own question (sorry)

after changin the application/json map, add the following to Httprepl Content Type Middleware Alist:

 (json
  (lambda
    (b)
    (json-mode)
  b))

To get rid of headers in the response, change the Httprepl Response Middleware variable from

(httprepl-apply-content-type-middleware httprepl-comment-headers)

to

(httprepl-apply-content-type-middleware httprepl-delete-headers)
gregsexton commented 9 years ago

Glad you got this resolved.