Skip to content

Commit 1a33fe1

Browse files
committed
Changes while reviewing
1 parent fe482d0 commit 1a33fe1

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

rest.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ const checkPatchOverrideSupport = function (req, res) {
4040
* @param {Object} res - Express response object
4141
* @param {Function} next - Express next middleware function
4242
*/
43+
const SKIP_CONTENT_TYPE_METHODS = ["GET", "HEAD", "OPTIONS", "DELETE"]
4344
const validateContentType = function (req, res, next) {
44-
const SKIP_CONTENT_TYPE_METHODS = ["GET", "HEAD", "OPTIONS", "DELETE"]
45-
if (SKIP_CONTENT_TYPE_METHODS.includes(req.method)) {
45+
if (SKIP_CONTENT_TYPE_METHODS.includes(req.method) || req.path.startsWith("/release")) {
4646
return next()
4747
}
4848
const contentType = (req.get("Content-Type") ?? "").toLowerCase()
@@ -54,7 +54,7 @@ const validateContentType = function (req, res, next) {
5454
}
5555
const mimeType = contentType.split(";")[0].trim()
5656
if (mimeType === "application/json" || mimeType === "application/ld+json") return next()
57-
const isSearchEndpoint = req.path.startsWith("/search")
57+
const isSearchEndpoint = req.path === "/search" || req.path.startsWith("/search/")
5858
if (mimeType === "text/plain" && isSearchEndpoint) return next()
5959
const acceptedTypes = `"application/json" or "application/ld+json"${isSearchEndpoint ? ' or "text/plain"' : ''}`
6060
next(createExpressError({

0 commit comments

Comments
 (0)