Skip to content

Commit d69f977

Browse files
committed
refactor: update enum
1 parent 7bbe0fa commit d69f977

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ export class Client {
105105
...extraHeaders,
106106
}
107107

108-
if (method === HTTPMethod.Put) {
108+
if (method === HTTPMethod.PUT) {
109109
headers['cache-control'] = 'max-age=0, stale-while-revalidate=60'
110110
}
111111

@@ -124,7 +124,7 @@ export class Client {
124124
const fetcher = this.fetcher ?? globalThis.fetch
125125
const res = await fetchAndRetry(fetcher, url, options)
126126

127-
if (res.status === 404 && method === HTTPMethod.Get) {
127+
if (res.status === 404 && method === HTTPMethod.GET) {
128128
return null
129129
}
130130

src/store.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class Store {
5555
}
5656

5757
async delete(key: string) {
58-
await this.client.makeRequest({ key, method: HTTPMethod.Delete, storeName: this.name })
58+
await this.client.makeRequest({ key, method: HTTPMethod.DELETE, storeName: this.name })
5959
}
6060

6161
async get(key: string): Promise<string>
@@ -70,7 +70,7 @@ class Store {
7070
options?: { type: 'arrayBuffer' | 'blob' | 'json' | 'stream' | 'text' },
7171
): Promise<ArrayBuffer | Blob | ReadableStream | string | null> {
7272
const { type } = options ?? {}
73-
const res = await this.client.makeRequest({ key, method: HTTPMethod.Get, storeName: this.name })
73+
const res = await this.client.makeRequest({ key, method: HTTPMethod.GET, storeName: this.name })
7474
const expiration = res?.headers.get(EXPIRY_HEADER)
7575

7676
if (typeof expiration === 'string') {
@@ -115,7 +115,7 @@ class Store {
115115
body: data,
116116
headers,
117117
key,
118-
method: HTTPMethod.Put,
118+
method: HTTPMethod.PUT,
119119
storeName: this.name,
120120
})
121121
}
@@ -131,7 +131,7 @@ class Store {
131131
body: payload,
132132
headers,
133133
key,
134-
method: HTTPMethod.Put,
134+
method: HTTPMethod.PUT,
135135
storeName: this.name,
136136
})
137137
}

src/types.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ export type BlobInput = ReadableStream | string | ArrayBuffer | Blob
33
export type Fetcher = typeof globalThis.fetch
44

55
export enum HTTPMethod {
6-
Delete = 'delete',
7-
Get = 'get',
8-
Put = 'put',
6+
DELETE = 'delete',
7+
GET = 'get',
8+
PUT = 'put',
99
}

0 commit comments

Comments
 (0)