From 79581656dc86ac0f08c255ac68512d2346309286 Mon Sep 17 00:00:00 2001 From: Andrew Plummer Date: Wed, 29 Jan 2025 06:24:05 +0900 Subject: [PATCH] api key casing --- services/web/src/components/RequestBlock/index.js | 2 +- services/web/src/docs/pages/GettingStarted.mdx | 4 ++-- services/web/src/utils/api/request.js | 3 +-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/services/web/src/components/RequestBlock/index.js b/services/web/src/components/RequestBlock/index.js index f9463456..e39b5127 100644 --- a/services/web/src/components/RequestBlock/index.js +++ b/services/web/src/components/RequestBlock/index.js @@ -67,7 +67,7 @@ export default class RequestBlock extends React.Component { getDefaultHeaders() { const { authToken, apiKey, request } = this.props; const headers = { - 'API-Key': `${apiKey || ''}`, + 'Api-Key': `${apiKey || ''}`, ...this.props.headers, }; if (authToken) { diff --git a/services/web/src/docs/pages/GettingStarted.mdx b/services/web/src/docs/pages/GettingStarted.mdx index 2ebbd472..d27c3835 100644 --- a/services/web/src/docs/pages/GettingStarted.mdx +++ b/services/web/src/docs/pages/GettingStarted.mdx @@ -21,9 +21,9 @@ Main production URL: ### API Key Each client using using the api must provide use an API key to identify itself. -You can provide your API key via an header (`API-Key: `): +You can provide your API key via an header (`Api-Key: `): -{`curl -H 'API-Key: ' ${API_URL}/`} +{`curl -H 'Api-Key: ' ${API_URL}/`} ### Authentication diff --git a/services/web/src/utils/api/request.js b/services/web/src/utils/api/request.js index 035eeb73..092bc0db 100644 --- a/services/web/src/utils/api/request.js +++ b/services/web/src/utils/api/request.js @@ -85,8 +85,7 @@ function getHeaders(options) { token ||= getToken(); return { Accept: 'application/json', - // TODO: casing - 'API-Key': API_KEY, + 'Api-Key': API_KEY, ...(token && { Authorization: `Bearer ${token}`, }),