Skip to content

Commit fde04c1

Browse files
author
Alan Shaw
committed
fix: remove middleware preventing range requests
1 parent 8343890 commit fde04c1

File tree

2 files changed

+0
-18
lines changed

2 files changed

+0
-18
lines changed

src/index.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import {
1717
} from '@web3-storage/gateway-lib/handlers'
1818
import {
1919
withContentClaimsDagula,
20-
withHttpRangeUnsupported,
2120
withVersionHeader,
2221
withCarBlockHandler
2322
} from './middleware.js'
@@ -45,7 +44,6 @@ export default {
4544
withCarBlockHandler,
4645
withContentClaimsDagula,
4746
withFormatRawHandler,
48-
withHttpRangeUnsupported,
4947
withFormatCarHandler,
5048
withContentDispositionHeader,
5149
withFixedLengthStream

src/middleware.js

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,6 @@ import { handleCarBlock } from './handlers/car-block.js'
1515
* @typedef {import('@web3-storage/gateway-lib').UnixfsContext} UnixfsContext
1616
*/
1717

18-
/**
19-
* Validates the request does not contain a HTTP `Range` header.
20-
* Returns 501 Not Implemented in case it has.
21-
* @type {import('@web3-storage/gateway-lib').Middleware<import('@web3-storage/gateway-lib').Context>}
22-
*/
23-
export function withHttpRangeUnsupported (handler) {
24-
return (request, env, ctx) => {
25-
// Range request https://github.com/web3-storage/gateway-lib/issues/12
26-
if (request.headers.get('range')) {
27-
throw new HttpError('Not Implemented', { status: 501 })
28-
}
29-
30-
return handler(request, env, ctx)
31-
}
32-
}
33-
3418
/**
3519
* Middleware that will serve CAR files if a CAR codec is found in the path
3620
* CID. If the CID is not a CAR CID it delegates to the next middleware.

0 commit comments

Comments
 (0)