Skip to content

@route content negotiation #1173

@sharpaper

Description

@sharpaper

Does Bottle support content negotiation? Sometimes it's the client that specifies to the server what format it wants back, for example the same URL can be used to return an HTML version of the resource, or JSON, or RDF, or XML. Can Bottle support this? More or less like this:

@route('/resource', accept-header='text/html'):
def html():
    return resource as html

@route('/resource', accept-header='text/turtle'):
def turtle():
    return resource as turtle file

@route('/resource', accept-header='application/xml'):
def xml():
    return resource as xml file

Metadata

Metadata

Assignees

No one assigned

    Labels

    FeatureThis is a feature request, not a bug. Open for discussion.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions