macchiato-framework / macchiato-core

Ring style HTTP server abstraction for Node.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

restful-format middleware can't serialize a root vector

denisidoro opened this issue · comments

Using the restful-format as highlighted here works for, say:

{:message "hello"}

but not for

[1 2 3]

The middleware is using the following multimethod to serialize responses, and it's not doing anything special regarding maps and vectors handling. If you could investigate a bit more that would be really helpful, otherwise I'll try take a look when I get a chance.

@yogthos, the problem is with deserialize-request, I guess:

cljs.user=> (js->clj (js/JSON.parse "{\"a\": 1}") :keywordize-keys true)
{:a 1}

cljs.user=> (js->clj (js/JSON.parse "[1 2 3]") :keywordize-keys true)
Unexpected number in JSON at position 3

Nevermind. The problem was that I wasn't using -H "Accept: application/json" in my curl command