mirror of
https://github.com/nbd-wtf/nostr-tools.git
synced 2025-12-08 16:28:49 +00:00
fix(nip98): Add support for HEAD, PUT, CONNECT, OPTIONS, TRACE and PATCH http methods
This PR adds common HTTP methods (as listed on https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods)
This commit is contained in:
9
nip98.ts
9
nip98.ts
@@ -10,7 +10,14 @@ import {utf8Decoder, utf8Encoder} from './utils'
|
||||
|
||||
enum HttpMethod {
|
||||
Get = 'get',
|
||||
Head = 'head',
|
||||
Post = 'post'
|
||||
Put = 'put'
|
||||
Delete = 'delete'
|
||||
Connect = 'connect'
|
||||
Options = 'options'
|
||||
Trace = 'trace'
|
||||
Patch = 'patch'
|
||||
}
|
||||
|
||||
const _authorizationScheme = 'Nostr '
|
||||
@@ -32,7 +39,7 @@ export async function getToken(
|
||||
): Promise<string> {
|
||||
if (!loginUrl || !httpMethod)
|
||||
throw new Error('Missing loginUrl or httpMethod')
|
||||
if (httpMethod !== HttpMethod.Get && httpMethod !== HttpMethod.Post)
|
||||
if (!httpMethod in HttpMethod)
|
||||
throw new Error('Unknown httpMethod')
|
||||
|
||||
const event = getBlankEvent(Kind.HttpAuth)
|
||||
|
||||
Reference in New Issue
Block a user