You need to set the content-type = 'application/json' when you POST json
content. Else web2py does not know it is json and inteprets is incorrectly
as a multipart form.
On Wednesday, 27 July 2016 05:01:57 UTC-5, Yebach wrote:
>
> Did you menage to solve this. I am facing the same issue here and it is
> killing me.
>
> On Thursday, July 9, 2015 at 2:46:52 PM UTC+2, kk wrote:
>>
>> In gluon.globals, I found a behavior that I don't understand, and that
>> gives me an headache.
>>
>> class Request(Storage):
>> ...
>> def parse_post_vars(self):
>> ...
>> if len(pvalue): *post_vars[key] = (len(pvalue) > 1 and pvalue) or
>> pvalue[0]*
>>
>>
>> The above underlined line is what I am talking about. When the browser
>> post a json object with an array, if the array length is 1, it simply
>> returns the first argument and denatures the array property. Also, the key
>> of the object is appended '[]'. For example, when I submit
>> {'key':['value1']}, what I get in request.post_vars is {'key[]':'value1'}.
>>
>> Is it an intended behavior, or a bug? I am not sure whether this question
>> belongs to web2py-users or web2py-dev; posting here hoping this is a
>> well-known issue.
>>
>> Thanks in advance for any response!
>>
>>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.