Was it just about the content-type?!

This commit is contained in:
2022-12-25 15:03:35 +01:00
parent ef2a17380b
commit ff9689f84c
2 changed files with 5 additions and 5 deletions

View File

@@ -19,15 +19,14 @@ export const POST = (async ({ request, fetch }) => {
// Newsletter API request
const req = await fetch(`https://emailoctopus.com/api/1.6/lists/${NEWSLETTER_LIST_ID}/contacts`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
headers: { 'content-type': 'application/json' },
body: JSON.stringify({
api_key: NEWSLETTER_API_TOKEN,
email_address: email,
})
})
const res = await req.text()
const res = await req.json()
console.log('server:', res)
return new Response(res)
// Other error
if (res && res.status !== 'PENDING') {