Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# v2.8.1 (Thu Oct 02 2025)

#### 🐛 Bug Fix

- Add missing Content-Type header to POST requests to fix 422 errors ([@damianjachyra](https://github.com/damianjachyra))
- Fix header casing from X-Magic-Secret-key to X-Magic-Secret-Key ([@damianjachyra](https://github.com/damianjachyra))

#### Authors: 1

- Damian Jachyra ([@damianjachyra](https://github.com/damianjachyra))

---

# v2.8.0 (Fri Sep 12 2025)

#### 🚀 Enhancement
Expand Down
7 changes: 5 additions & 2 deletions src/utils/rest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ export function post<TBody extends Record<string, string | number | boolean>, TR
) {
return emitRequest<TResponse>(url, {
method: 'POST',
headers: { 'X-Magic-Secret-key': secretApiKey },
headers: {
'X-Magic-Secret-Key': secretApiKey,
'Content-Type': 'application/json'
},
body: JSON.stringify(body),
});
}
Expand All @@ -50,6 +53,6 @@ export function get<TResponse>(url: string, secretApiKey: string, params?: any)
const urlWithParams = generateQuery(url, params);
return emitRequest<TResponse>(urlWithParams, {
method: 'GET',
headers: { 'X-Magic-Secret-key': secretApiKey },
headers: { 'X-Magic-Secret-Key': secretApiKey },
});
}
4 changes: 2 additions & 2 deletions test/spec/utils/rest/get.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ test('Successfully GETs to the given endpoint & stringifies query params', async
'https://example.com/hello/world?foo=hello&bar=world',
{
method: 'GET',
headers: { 'X-Magic-Secret-key': API_KEY },
headers: { 'X-Magic-Secret-Key': API_KEY },
},
]);
});
Expand All @@ -39,7 +39,7 @@ test('Successfully GETs to the given endpoint with no query params', async () =>
'https://example.com/hello/world',
{
method: 'GET',
headers: { 'X-Magic-Secret-key': API_KEY },
headers: { 'X-Magic-Secret-Key': API_KEY },
},
]);
});
5 changes: 4 additions & 1 deletion test/spec/utils/rest/post.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ test('Successfully POSTs to the given endpoint & stringifies body', async () =>
'https://example.com/hello/world',
{
method: 'POST',
headers: { 'X-Magic-Secret-key': API_KEY },
headers: {
'X-Magic-Secret-Key': API_KEY,
'Content-Type': 'application/json'
},
body: '{"public_address":"0x0123"}',
},
]);
Expand Down