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

Send and receive dictionaries instead of json strings #13

Open
mnieber opened this issue Dec 25, 2017 · 3 comments
Open

Send and receive dictionaries instead of json strings #13

mnieber opened this issue Dec 25, 2017 · 3 comments

Comments

@mnieber
Copy link

mnieber commented Dec 25, 2017

Hi, I forked your repo to make it work for my use-case based on Django 2.0. The most significant change I made is to use dictionaries instead of json strings:

Out of curiosity: why are strings used instead of dictionaries in your repo? I must say that I was very opportunistic in changing the code to make it work for me, and did not spend a lot of time on thinking how things ought to work from a theoretical point of view. I came up with this solution because it seemed the most practical one.

If you are interested (and I have enough time) I could make a pull request with my changes.

@tanwanirahul
Copy link
Owner

@mnieber - Thanks for raising this. The idea of keeping it to strings was that, the framework itself needs to be generic and it should be able to handle multiple representation formats, which is not unusual with REST APIs. This way, we have 2 advantages:

  1. We can support non JSON (xml, yml etc) http calls.
  2. Avoids serializing and deserializing the json from string and back.

Feel free to express your views.

@mnieber
Copy link
Author

mnieber commented Nov 17, 2018

Hi Rahul,

I think that it would be really useful to have a batch-request feature in Django 2, so I took another look at your solution. I agree that a string is actually a reasonable format to use as the body in each request. However, I'm running into too many strange decoding-related errors when executing the tests. Probably your approach is fine but there are several Django 2 implementation details that need to be taken into account. Maybe I will try again later.

@tanwanirahul
Copy link
Owner

@mnieber You may be correct about issues with Django 2.0. I haven't tried with Django 2.0 before. If you could share some sample failing tests, it would help to know what the issues could be, and we could quickly supply a fix.

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

No branches or pull requests

2 participants