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

capitalization of the keys in querystring #7

Open
khurramar opened this issue Feb 21, 2018 · 2 comments
Open

capitalization of the keys in querystring #7

khurramar opened this issue Feb 21, 2018 · 2 comments

Comments

@khurramar
Copy link

khurramar commented Feb 21, 2018

Adobe ColdFusion 10
default parameter EXCLUDE_FIELDS=_links was not working as it was being passed in capital letters. turning it into small letters exclude_fields=_links worked.

mailchimp.cfc
line: 325
original
response = listAppend(response, key & "=" & urlEncodedFormat(arguments.params[key]), "&");
changed
response = listAppend(response, lcase(key) & "=" & urlEncodedFormat(arguments.params[key]), "&");

Note: I am not yet fully aware of the mailchimp API as if it may need some parameters in mixed (lower/upper case) letters. In that case, this fix may lead to other issues as mailchimp API appears to be case sensitive.

@kevindb
Copy link
Owner

kevindb commented Feb 26, 2018

Would you please post the code that defines the params being passed into the mailchimp.cfc function?

@khurramar
Copy link
Author

Oh, please excuse me @kevindb for a very delayed response.

I actually didn't use the params argument in any of the functions I worked with. But it used to throw error because mailchimp.cfc adds a default parameter exclude_fields=_links in the params. The issue was that the statement which adds the default parameter is written as below

line #321 arguments.params.exclude_fields = "_links";

Doing this way will always add the key exclude_fields in caps, as EXCLUDE_FIELDS, that took a good time of mine as there was no reference at mailchimp's docs if it's case sensitive. I could have fix this statement as below

arguments.params["exclude_fields"] = "_links";

which will indeed keep the key in the format I write it in. But after looking at the mailchimp's api reference where they seem to be expecting all the keys in small letters (in example codes), I switched the code at line no 325. So all the keys turn to small letters before sending over to mailchimp. That couldn't be a good idea either. but it depends, if you expect the developer to pass the key as mailchimp expects, forget the change at line no 325. Do the change at line no. 321 and let the developer decide about its keys. Exactly as you asked me, how did I define the params to pass into mailchimp.cfc.

Hope this clarifies.

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

No branches or pull requests

2 participants