Skip to content

Commit 6233fa8

Browse files
committed
Fix linter errors
1 parent d65db2c commit 6233fa8

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

src/lib/seam/connect/error-interceptor.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ export const errorInterceptor = async (err: unknown): Promise<void> => {
1212

1313
const { response } = err
1414
const status = response?.status
15-
const headers = response?.headers
16-
const requestId = headers?.['seam-request-id'] ?? ''
15+
16+
const requestId = getRequestId(err)
1717

1818
if (status == null) throw err
1919

@@ -39,7 +39,7 @@ const isApiErrorResponse = (
3939

4040
if (headers == null) return false
4141

42-
const contentType = headers['content-type']
42+
const contentType = headers['Content-Type']
4343
if (
4444
typeof contentType === 'string' &&
4545
!contentType.startsWith('application/json')
@@ -59,3 +59,11 @@ const isApiErrorResponse = (
5959

6060
return false
6161
}
62+
63+
const getRequestId = (err: AxiosError): string => {
64+
const headers = err.response?.headers
65+
if (headers == null) return ''
66+
const requestId = headers['seam-request-id']
67+
if (requestId == null) return ''
68+
return requestId
69+
}

test/seam/connect/client.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ test('SeamHttp: merges axiosOptions when creating client', async (t) => {
7777
endpoint,
7878
axiosOptions: {
7979
transformResponse: [
80-
(data) =>
80+
(data: string) =>
8181
JSON.parse(
8282
data.replaceAll(seed.august_device_1, 'transformed-device-id'),
8383
),

0 commit comments

Comments
 (0)