This would break if we did that:
https://github.com/azavea/OTM2/blob/master/opentreemap/treemap/views.py#L682

I thought it would be more idiomatic to treat it is an empty dictionary,
since all of our requests so far have been flat (I think).

I totally don't mind changing it if you think it is too weird.


On Mon, Sep 9, 2013 at 5:15 PM, Justin Walgran <notifications@github.com>wrote:

> In opentreemap/opentreemap/util.py:
>
> > @@ -12,12 +12,9 @@ def routed(request, *args2, **kwargs2):
> >
> >
> >  def json_from_request(request):
> > -    """
> > -    Accessing body throws an exception when using the Django test
> > -    client in to make requests in unit tests.
> > -    """
> > -    try:
> > -        data = json.loads(request.body)
> > -    except Exception:
> > -        data = request.POST
> > -    return data
> > +    body = request.body
> > +
> > +    if len(body) == 0:
> > +        return {}
>
> Do we want to return a "fake" empty object here? None seems more
> appropriate.
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/azavea/OTM2/pull/301/files#r6251250>
> .
>



-- 
Adam Hinz
Software Engineer, Azavea
hinz.adam@gmail.com | c: 608-445-8391 | Twitter: @ahinz