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

Fix wrap-nested-params for non-form content-types #235

Merged
merged 1 commit into from
Dec 13, 2014

Conversation

r0man
Copy link
Contributor

@r0man r0man commented Dec 6, 2014

The wrap-nested-params always kicked in, except when the :content-type
was set to :json. When sending nested structures as :edn or :transit the
payload got also nested. This PR fixes that problem, by only nesting if
there is no content type set (which defaults to x-www-form-urlencoded)
or if the content type is x-www-form-urlencoded.

:form-params params})]
(is (= 200 (:status resp)))
(is (= "close" (get-in resp [:headers "connection"])))
(prn (:body resp))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like a leftover prn?

@dakrone
Copy link
Owner

dakrone commented Dec 9, 2014

@r0man this causes a lot of test failures it look like: https://gist.github.com/dakrone/6b2fd64508b5fcd355ea

@r0man
Copy link
Contributor Author

r0man commented Dec 10, 2014

@dakrone I'll take a look ...

@r0man r0man force-pushed the nested-params-fix branch 2 times, most recently from 158f7de to 161781c Compare December 12, 2014 14:20
@r0man
Copy link
Contributor Author

r0man commented Dec 12, 2014

@dakrone Sorry, for the failing tests. Not sure what I did
there. The tests should pass now on all profiles. Can you take a
look again?

(defn ^:dynamic parse-transit
"Resolve and apply Transit's JSON/MessagePack parsing."
[& args]
(defn transit-decode
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we leave this as ^:dynamic and named parse-transit? I am trying to stick with the convention of parse-edn and parse-html, as well as making it rebindable so people can implement their own transit parsing if desired.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked at the JSON fns and thought that's the convention. ;)
Anyway renamed this back to parse-transit and made it dynamic.

@dakrone
Copy link
Owner

dakrone commented Dec 12, 2014

@r0man left a few comments

The `wrap-nested-params` always kicked in, except when the :content-type
was set to :json. When sending nested structures as :edn or :transit the
payload got also nested. This PR fixes that problem, by only nesting if
there is no content type set (which defaults to x-www-form-urlencoded)
or if the content type is x-www-form-urlencoded.
@dakrone dakrone merged commit 4044f85 into dakrone:master Dec 13, 2014
@dakrone
Copy link
Owner

dakrone commented Dec 13, 2014

Merged, thanks!

@r0man
Copy link
Contributor Author

r0man commented Dec 13, 2014

Cool. Thx!

On Sat, Dec 13, 2014 at 8:31 PM, Lee Hinman notifications@github.com
wrote:

Merged, thanks!


Reply to this email directly or view it on GitHub
#235 (comment).

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

Successfully merging this pull request may close these issues.

2 participants