Re: Bug in utils.encoding producing invalid JSON for request body

2018-01-29 Thread Adam Johnson
Sorry, replying on ticket. On 29 January 2018 at 16:53, Nick Sarbicki wrote: > There's been a longer discussion on the ticket about this. The point you > raise I agree with. I also think _encode_data should be left alone. > > I still think this should be in framework instead of having to subclas

Re: Bug in utils.encoding producing invalid JSON for request body

2018-01-29 Thread Nick Sarbicki
There's been a longer discussion on the ticket about this. The point you raise I agree with. I also think _encode_data should be left alone. I still think this should be in framework instead of having to subclass RequestFactory. Passing in a dict as data should not give invalid JSON. Instead it w

Re: Bug in utils.encoding producing invalid JSON for request body

2018-01-29 Thread Adam Johnson
> > the JSON it produces (it does try) > I wouldn't say it "tries", it just calls str on any object that is passed in, which for a simple dict with strings in, looks close to JSON. force_bytes definitely shouldn't be trying to JSON-coerce things. Thus I don't think it's a bug. Bugs are when behav

Bug in utils.encoding producing invalid JSON for request body

2018-01-29 Thread Nick Sarbicki
I've just posted a ticket for this here: https://code.djangoproject.com/ticket/29082#ticket The general point is that when I'm using RequestFactory and making a post request with a JSON body, I'd expect to be able to pass in a dict for this - but I can't as the JSON it produces (it does try) is