The docs say you can set trailing_slash=False
but how can you allow both endpoints to work, with or without a trailing slash?
For anyone using rest_framework_extensions with ExtendedSimpleRouter, the accepted solution needs a small modification. The self.trailling_slash has to be after the super() like this.
from rest_framework_extensions.routers import ExtendedSimpleRouter
class OptionalSlashRouter(ExtendedSimpleRouter):
def __init__(self):
super(ExtendedSimpleRouter, self).__init__()
self.trailing_slash = "/?"