diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2f10a60..c2873b7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -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
diff --git a/src/utils/rest.ts b/src/utils/rest.ts
index 69b6d9a..176d8b8 100644
--- a/src/utils/rest.ts
+++ b/src/utils/rest.ts
@@ -38,7 +38,10 @@ export function post
, TR
) {
return emitRequest(url, {
method: 'POST',
- headers: { 'X-Magic-Secret-key': secretApiKey },
+ headers: {
+ 'X-Magic-Secret-Key': secretApiKey,
+ 'Content-Type': 'application/json'
+ },
body: JSON.stringify(body),
});
}
@@ -50,6 +53,6 @@ export function get(url: string, secretApiKey: string, params?: any)
const urlWithParams = generateQuery(url, params);
return emitRequest(urlWithParams, {
method: 'GET',
- headers: { 'X-Magic-Secret-key': secretApiKey },
+ headers: { 'X-Magic-Secret-Key': secretApiKey },
});
}
diff --git a/test/spec/utils/rest/get.spec.ts b/test/spec/utils/rest/get.spec.ts
index e87f69d..175bc9c 100644
--- a/test/spec/utils/rest/get.spec.ts
+++ b/test/spec/utils/rest/get.spec.ts
@@ -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 },
},
]);
});
@@ -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 },
},
]);
});
diff --git a/test/spec/utils/rest/post.spec.ts b/test/spec/utils/rest/post.spec.ts
index 5e71e76..a358673 100644
--- a/test/spec/utils/rest/post.spec.ts
+++ b/test/spec/utils/rest/post.spec.ts
@@ -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"}',
},
]);