-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: re-export everything from the
@std/http
module
It currently includes deprecated things, but those will be removed by deno_std stabilizing this month. BREAKING CHANGE: `createStandardResponse` and `STATUS_CODE` are now exported from hado/http instead of hado/router
- Loading branch information
Showing
5 changed files
with
125 additions
and
96 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -30,7 +30,7 @@ import { | |
type InputOptions, | ||
Select as _Select, | ||
type SelectOptions, | ||
} from 'jsr:@cliffy/[email protected].4' | ||
} from 'jsr:@cliffy/[email protected].5' | ||
import { $ } from 'jsr:@david/dax' | ||
import { Spinner } from 'jsr:@std/cli' | ||
import { bold, cyan, dim, green, magenta } from 'jsr:@std/fmt/colors' | ||
|
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,27 @@ | ||
/** | ||
* @module http | ||
* | ||
* @description | ||
* A collection of HTTP utilities. | ||
*/ | ||
|
||
import { STATUS_TEXT, type StatusCode } from '@std/http' | ||
|
||
// re-export everything from the standard HTTP module | ||
export * from '@std/http' | ||
|
||
/** | ||
* Creates a standard response with the given status code. | ||
* @param status The status code. | ||
* @param init The response init. | ||
* @returns The response. | ||
* | ||
* @example | ||
* ```ts | ||
* const response = createStandardResponse(STATUS_CODE.NotFound) | ||
* ``` | ||
*/ | ||
export function createStandardResponse(status: StatusCode, init?: ResponseInit): Response { | ||
const statusText = STATUS_TEXT[status] | ||
return new Response(statusText, { status, statusText, ...init }) | ||
} |
Oops, something went wrong.