Skip to content

Commit

Permalink
Update:API endpoint /search/podcast throw 400 error if term query par…
Browse files Browse the repository at this point in the history
…am is not supplied
  • Loading branch information
advplyr committed Dec 17, 2023
1 parent 05820aa commit dc67a52
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions server/controllers/SearchController.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,19 @@ class SearchController {
})
}

/**
* Find podcast RSS feeds given a term
*
* @param {import('express').Request} req
* @param {import('express').Response} res
*/
async findPodcasts(req, res) {
const term = req.query.term
if (!term) {
Logger.error('[SearchController] Invalid request query param "term" is required')
return res.status(400).send('Invalid request query param "term" is required')
}

const results = await PodcastFinder.search(term)
res.json(results)
}
Expand Down

0 comments on commit dc67a52

Please sign in to comment.