From 2be9c7dcc1f418726a19e99cfdb3933257a03c6f Mon Sep 17 00:00:00 2001 From: Fallenbagel <98979876+Fallenbagel@users.noreply.github.com> Date: Wed, 24 Jul 2024 19:34:54 +0500 Subject: [PATCH] fix: add missing content-type header (#887) * fix: add missing headers when commenting on an issue * fix: more missing content-type headers in post requests --- src/components/IssueDetails/IssueComment/index.tsx | 3 +++ src/components/IssueDetails/index.tsx | 6 ++++++ src/components/Login/AddEmailModal.tsx | 3 +++ src/components/Login/index.tsx | 3 +++ 4 files changed, 15 insertions(+) diff --git a/src/components/IssueDetails/IssueComment/index.tsx b/src/components/IssueDetails/IssueComment/index.tsx index aa5a65dc3..0c36ca664 100644 --- a/src/components/IssueDetails/IssueComment/index.tsx +++ b/src/components/IssueDetails/IssueComment/index.tsx @@ -181,6 +181,9 @@ const IssueComment = ({ `/api/v1/issueComment/${comment.id}`, { method: 'PUT', + headers: { + 'Content-Type': 'application/json', + }, body: JSON.stringify({ message: values.newMessage }), } ); diff --git a/src/components/IssueDetails/index.tsx b/src/components/IssueDetails/index.tsx index e4b952e22..a5ec6391a 100644 --- a/src/components/IssueDetails/index.tsx +++ b/src/components/IssueDetails/index.tsx @@ -126,6 +126,9 @@ const IssueDetails = () => { try { const res = await fetch(`/api/v1/issueComment/${firstComment.id}`, { method: 'PUT', + headers: { + 'Content-Type': 'application/json', + }, body: JSON.stringify({ message: newMessage }), }); if (!res.ok) throw new Error(); @@ -501,6 +504,9 @@ const IssueDetails = () => { `/api/v1/issue/${issueData?.id}/comment`, { method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, body: JSON.stringify({ message: values.message }), } ); diff --git a/src/components/Login/AddEmailModal.tsx b/src/components/Login/AddEmailModal.tsx index a6ce794a8..f5dafa7c7 100644 --- a/src/components/Login/AddEmailModal.tsx +++ b/src/components/Login/AddEmailModal.tsx @@ -59,6 +59,9 @@ const AddEmailModal: React.FC = ({ try { const res = await fetch('/api/v1/auth/jellyfin', { method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, body: JSON.stringify({ username: username, password: password, diff --git a/src/components/Login/index.tsx b/src/components/Login/index.tsx index f0e9ab42c..27695d19f 100644 --- a/src/components/Login/index.tsx +++ b/src/components/Login/index.tsx @@ -45,6 +45,9 @@ const Login = () => { try { const res = await fetch('/api/v1/auth/plex', { method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, body: JSON.stringify({ authToken }), }); if (!res.ok) throw new Error();