c.req.headers.get --> c.req.header, hono deprecation

This commit is contained in:
Alex Gleason 2023-11-20 12:39:20 -06:00
parent bedc8fdf91
commit c1bf326981
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
4 changed files with 5 additions and 5 deletions

View File

@ -28,8 +28,8 @@ const streamSchema = z.enum([
type Stream = z.infer<typeof streamSchema>;
const streamingController: AppController = (c) => {
const upgrade = c.req.headers.get('upgrade');
const token = c.req.headers.get('sec-websocket-protocol');
const upgrade = c.req.header('upgrade');
const token = c.req.header('sec-websocket-protocol');
const stream = streamSchema.optional().catch(undefined).parse(c.req.query('stream'));
if (upgrade?.toLowerCase() !== 'websocket') {

View File

@ -117,7 +117,7 @@ function prepareFilters(filters: ClientREQ[2][]): Filter[] {
}
const relayController: AppController = (c) => {
const upgrade = c.req.headers.get('upgrade');
const upgrade = c.req.header('upgrade');
if (upgrade?.toLowerCase() !== 'websocket') {
return c.text('Please use a Nostr client to connect.', 400);

View File

@ -6,7 +6,7 @@ const BEARER_REGEX = new RegExp(`^Bearer (${nip19.BECH32_REGEX.source})$`);
/** NIP-19 auth middleware. */
const auth19: AppMiddleware = async (c, next) => {
const authHeader = c.req.headers.get('authorization');
const authHeader = c.req.header('authorization');
const match = authHeader?.match(BEARER_REGEX);
if (match) {

View File

@ -25,7 +25,7 @@ async function signEvent<K extends number = number>(
opts: SignEventOpts = {},
): Promise<Event<K>> {
const seckey = c.get('seckey');
const header = c.req.headers.get('x-nostr-sign');
const header = c.req.header('x-nostr-sign');
if (seckey) {
return finishEvent(event, seckey);