Skip to content

:keywords? true not honored when auto-detecting the response format #231

Open
@mbertheau

Description

@mbertheau

This code honors :keywords? true:

(POST url
                   {:headers         {:X-CSRFToken csrf-token}
                    :params          data
                    :response-format :json
                    :keywords?       true
                    :handler         on-success
                    :error-handler   on-error})

In order to support transit responses, I removed :response-format so that cljs-ajax will use the Content-Type of the response to determine the response format:

(POST url
                   {:headers         {:X-CSRFToken csrf-token}
                    :params          data
                    :keywords?       true
                    :handler         on-success
                    :error-handler   on-error})

That does work, and I can receive transit and json responses fine. However, with JSON responses :keywords? isn't honored anymore and map keys are strings instead of keywords. Is this the intended behavior?

Btw, the fix I'm running now is to explicitly specify the two response formats that I need supported:

(POST url
                   {:headers         {:X-CSRFToken csrf-token}
                    :params          data
                    :response-format [:json :transit]
                    :keywords?       true
                    :handler         on-success
                    :error-handler   on-error})

Auto-detecting which one it is still works, and :keywords? is honored as well.

But it seems arbitrary that in the second example :keywords? should be ignored.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions