-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Alan Shaw
committed
Sep 19, 2024
1 parent
ae464e5
commit 5b13727
Showing
5 changed files
with
54 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/** | ||
* Determine if the request is for a specific byte range. | ||
* @param {Headers} headers | ||
*/ | ||
export const isRangeRequest = headers => headers.get('Range') != null | ||
|
||
/** | ||
* Determine if the request is for an alternative format, like an IPLD block or | ||
* a CAR file. | ||
* @param {Headers} headers | ||
* @param {URLSearchParams} searchParams | ||
*/ | ||
export const isAlternateFormatRequest = (headers, searchParams) => { | ||
const format = searchParams.get('format') | ||
const accept = headers.get('Accept') | ||
return Boolean(format || accept?.includes('application/vnd.ipld.')) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters