Skip to content

Commit

Permalink
fix: send error response and proper json in ai post requests
Browse files Browse the repository at this point in the history
  • Loading branch information
ebubae committed Nov 5, 2024
1 parent e54df1c commit 70eb8d2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/controllers/speechToText.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export const getTranscription: MiddleWare = async (req, res, next) => {
data: payload,
});

return res.send({ transcription: response.transcription });
return res.status(200).json({ transcription: response.transcription });
} catch (err) {

Check warning on line 70 in src/controllers/speechToText.ts

View workflow job for this annotation

GitHub Actions / Run linters

'err' is defined but never used
return next();
}
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/translation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export const getTranslation: MiddleWare = async (req, res, next) => {
data: payload,
});

return res.send({ translation: response.translation });
return res.status(200).json({ translation: response.translation });
} catch (err) {
return next(err);
}
Expand Down

0 comments on commit 70eb8d2

Please sign in to comment.