collective / sphinxcontrib-httpexample

Adds example directive for sphinx-contrib httpdomain
23 stars 20 forks source link

Parse responses even if they don't specify the HTTP version #45

Closed gforcada closed 5 years ago

gforcada commented 5 years ago

I'm writing the documentation of a django REST framework based service and I noticed that copy&pasting the output given by the browsable API from django REST framework does not work with this sphinx extension.

Seems that the problem is that django returns HTTP 201 Created rather than HTTP/1.1 201 Created.

gforcada commented 5 years ago

After having a look at the code, it seems that the problem is from upstream (i.e. in Python's BaseHTTPRequestHandler :confused: ), the parse_request method expects a version to be there, if not it errors right away.

datakurre commented 5 years ago

Possibly the version could be injected there before calling?

gforcada commented 5 years ago

yes, that's what I thought as well, I will see if I have time to look at it.

datakurre commented 5 years ago

at least a failing test would be great!

Curious that Django REST API was done with such, almost non-standard, responses.

datakurre commented 5 years ago

Should be fixed in 0.10.3