Yeah, because hitting a roadblock only happens in Django

Why are you trying to read the request directly? django parses it in
request.body, request.GET, request.POST, request.FILES, etc

https://docs.djangoproject.com/en/1.10/ref/request-response/

On 1/4/17, Flávio Cardoso <flavio.scard...@gmail.com> wrote:
> Wow, that's sad.... :(
>
> I'll port it to C#
>
>
>
> Em sexta-feira, 30 de dezembro de 2016 19:52:49 UTC-2, Flávio Cardoso
> escreveu:
>
>> Hello! I'm getting crazy, PLEASE someone, give me some light!!!
>>
>> I'm using Django 1.10.4, Python 3.5 on Windows using Visual Studio
>> Community 2015.
>>
>> I have some class-based views to response some json.
>>
>> from django.views.generic import View
>> from json import loads
>> from bson.json_util import dumps
>> from django.http import HttpResponse, HttpRequest
>>
>> class Topicos(View):
>>    def post(self, request):
>>        req = request.read().decode(self.request.encoding)
>>
>> Have the following setting on urls.py:
>>
>> url(r'^api/Topicos', Topicos.Topicos.as_view(), name='Topicos'),
>>
>> The request.read() is empty, the request is:
>>
>> POST /api/Topicos HTTP/1.1
>> Host: localhost:55020
>> Connection: keep-alive
>> Content-Length: 93
>> Accept: application/json, text/plain, */*
>> Origin: http://localhost:55020
>> User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36
>> (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36
>> X-CSRFToken:
>> VRiCt3Lz1EIdKGWt3lknpcgdFpD8XbrwSxdPT4P9dd1tbrGYmgE8uHdEIH2dzP5h
>> Content-Type: application/json;charset=UTF-8
>> Referer: http://localhost:55020/
>> Accept-Encoding: gzip, deflate, br
>> Accept-Language: pt-BR,pt;q=0.8,en-US;q=0.6,en;q=0.4
>> Cookie:
>> csrftoken=VRiCt3Lz1EIdKGWt3lknpcgdFpD8XbrwSxdPT4P9dd1tbrGYmgE8uHdEIH2dzP5h
>>
>> {"titulo":"Título 1","mensagem":"mensagem","email":"fla...@email.test
>> .br","usuario":"Flávio"}
>>
>>
>> I really don't know what else I can do. I have the same code (except na
>> class name) running correctly to another posts.
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/1da72b67-1eb4-4dde-9e13-b3faa8d7c0c0%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALn3ei3M2KzDiTUgYY_CLuBQSy9qfhMpDxebczWKShcYiL2EDQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to