Add support for some "forwarded" headers, included several new
attributes and a reworking of some of the existing code to better
facilitate sharing and performance.
Also clean up a couple tiny nits in the docstrings for the sake of
consistency.
The CompiledRouter is not pickle-able because the default responder uses
function within functions. As a result, the CompiledRouter cannot be
shared between processes using IPC mechanisms, which utilize pickles
internally. Replace the function within functions with partials of
module level functions so that the CompiledRouter can be pickled. Also,
change the traverse method to use the function wrapped by the partial to
preserve existing functionality.
* feat: Add 501 Not Implemented error class
* feat: Add 504 Gateway Timeout class
* feat: Add 505 Version Not Supported class
* refactor: Update tests to rebase on master
* doc: Remove duplicates from docstrings
* feat(Requests): Added a get_param_as_datetime() method to fetch query param as datetime
* fix(Request): Require UTC timezone designator
* test(Request): Require UTC timezone designator
This is a first pass at a non-breaking change that'll allow for a customizable media handling system. This approach combines many of the suggestions brought up by the community in #145.
One the thing that is left out of this PR is handling full content negotiation (i.e. connecting the request's accept header to the response's content-type). Unfortunately, this is a harder problem to solve in a backwards compatible fashion that doesn't affect performance. However, especially as we move towards v2, I think that would be a great opportunity to revisit full negotiation. In the meantime, there are several easy workarounds for people needing this functionality.
Closes #145
Rather than compiling the routing tree directly to Python code,
first generate an AST and then use it to produce the code. This
provides several benefits, including:
* It makes the compilation process easier to reason about.
* It makes it easier to keep track of indentation and whitespace.
* It sets us up for being able to make transformations that we
will need to do to support URI template filters, etc. in the
future.
Add a hug ecosystem test to validate Falcon against the most recent
Hug release, to ensure we aren't breaking anything over there. Along
the way, reorganize test scripts and requirement files since the
addition of the Hug tests would make the old structure even more
confusing than it already was.
* added Response.delete_header()
* feat(Response): add Response.delete_header()
Previously, `Response` had methods to get and set headers, but no way to
delete them, once set. We came across a need to delete response headers
that had been set upstream, and without a `delete_header` method we've
had to resort to directly manipulating `Response._headers`. This PR
alleviates that abstraction-violation.
Fix the following bugs:
* Only the '.' special character is properly handled, even though
some URL schemas, such as OData, make use of other characters,
like parens.
* Using duplicate field names leads to a nasty re error being
raised in the case of them being contained to the same
path segment, and a silent overwriting of param values in the
case of field values being duplicated across multiple segments.
Rework the tutorial to be more consistent, and to better explain
certain principles that drive Falcon's design.
Along the way, polish a few other areas of the docs where someone
might land during or immediate after walking through the tutorial.