# drf-ignore-slash-middleware
Django middleware that makes urls ending with and without slashes equivalent
When using [DRF](https://www.django-rest-framework.org) routers you have a choice to either have urls end with trailing slash (default) or not.
i.e `DefaultRouter(trailing_slash=False)`. You can't however have it both ways, as in ignore them.
This package defines a very simple middleware class that removes trailing slashes from urls if they have one.
So in order to ignore trailing slashes and have `/api/some_url` be equivalent to `/api/some_url/` simply install the package and add the middleware class as the first entry in the MIDDLEWARE list. Please note that middleware [changed in django 1.10](https://docs.djangoproject.com/en/1.10/topics/http/middleware/) and this this pacakge requires django version >= 1.10.
```python
MIDDLEWARE = [
# Should be first entry
'drf_ignore_slash_middleware.SlashIgnoreMiddleware',
# Rest of your middleware
]
```
Django middleware that makes urls ending with and without slashes equivalent
When using [DRF](https://www.django-rest-framework.org) routers you have a choice to either have urls end with trailing slash (default) or not.
i.e `DefaultRouter(trailing_slash=False)`. You can't however have it both ways, as in ignore them.
This package defines a very simple middleware class that removes trailing slashes from urls if they have one.
So in order to ignore trailing slashes and have `/api/some_url` be equivalent to `/api/some_url/` simply install the package and add the middleware class as the first entry in the MIDDLEWARE list. Please note that middleware [changed in django 1.10](https://docs.djangoproject.com/en/1.10/topics/http/middleware/) and this this pacakge requires django version >= 1.10.
```python
MIDDLEWARE = [
# Should be first entry
'drf_ignore_slash_middleware.SlashIgnoreMiddleware',
# Rest of your middleware
]
```
Release files for drf-ignore-slash-middleware 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| drf_ignore_slash_middleware-0.0.1.tar.gz | 1.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| drf_ignore_slash_middleware-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 5.9 kB
Release files / drf_ignore_slash_middleware-0.0.1.tar.gz
| Download URL | drf_ignore_slash_middleware-0.0.1.tar.gz |
|---|---|
| Size | 1.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3ed51accc471b44c8e7986e3667669f74e7fa303a516f774d7931d069c1d6f0d
|
|
BLAKE2b-256 checksum How to use checksums |
a10800ecbea7817303fde854a44e8455a64f138aaceb4de811c3464dcec91ba8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / drf_ignore_slash_middleware-0.0.1-py3-none-any.whl
| Download URL | drf_ignore_slash_middleware-0.0.1-py3-none-any.whl |
|---|---|
| Size | 4.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9c17b6c2ce16685455df4be0fe7d34c5f6fa4c61ddb4660ca5f253ea08914469
|
|
BLAKE2b-256 checksum How to use checksums |
403da019e71fe3cf296efe06a7fd0c3e0de222624e55e305f4b15028f618b93d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |