Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unrecognized response format: nil #2

Closed
olieidel opened this issue Oct 8, 2016 · 1 comment
Closed

unrecognized response format: nil #2

olieidel opened this issue Oct 8, 2016 · 1 comment

Comments

@olieidel
Copy link

olieidel commented Oct 8, 2016

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
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants