pylover / nanohttp

A very micro HTTP framework.
http://nanohttp.org
Other
46 stars 13 forks source link

Invalid keyword argument for `start_response` #120

Closed meyt closed 5 years ago

meyt commented 6 years ago

The start_response parameter is a callable accepting two required positional arguments, and one optional argument. For the sake of illustration, we have named these arguments status, response_headers, and exc_info, but they are not required to have these names, and the application must invoke the start_response callable using positional arguments. PEP 333

https://github.com/Carrene/nanohttp/blob/2d306d8a8e9e4d5e2e76da3587df711244116fb8/nanohttp/application.py#L71

pylover commented 6 years ago

Yes, of course.

But we need a way to handle errors in debug mode, from PEP333:

The exc_info argument, if supplied, must be a Python sys.exc_info() tuple. This argument should be supplied by the application only if start_response is being called by an error handler. If exc_info is supplied, and no HTTP headers have been output yet, start_response should replace the currently-stored HTTP response headers with the newly-supplied ones, thus allowing the application to "change its mind" about the output when an error has occurred.

meyt commented 6 years ago

Sorry for bad title, i just notice a linting problem, start_response must invoke using positional arguments.

meyt commented 6 years ago

@pylover Please take care about this issue.