day8 / re-frame-http-fx

A re-frame "effects handler" for performing Ajax tasks (via cljs-ajax)
MIT License
259 stars 27 forks source link

unrecognized response format: nil #2

Closed olieidel closed 7 years ago

olieidel commented 7 years ago

Playing around with a simple example yields this error:

Uncaught Error: ["unrecognized response format: " nil]

ajax$core$throw_error
ajax$core$get_response_forma
ajax$core$normalize_request
...

I strongly suspect that cljs-ajax.core/ajax-request needs a :response-format key as seen in the example. Looking at the relevant lines in core.cljc it seems that there is no default response-format onto which it could fall back; it therefore always throws an error when not response-format is provided.

Possible fixes could be: a) Providing the key in the map passed to :http-xhrio. However, my Clojure-Fu is not yet good enough to think of a way without clumsily including cljs.ajax.core in my re-frame handlers to access the various response-format-types.. b) Set some sort of default format and add it to the map.

Hope that helps! If you need anything further, let me know!

danielcompton commented 7 years ago

Hey, I've added specs and docs here to catch this, and opened #4 to discuss default response formats.