diff --git a/packages/kit/src/core/adapter-utils.js b/packages/kit/src/core/adapter-utils.js index 437219c6ccdc..ca3f61fbab3f 100644 --- a/packages/kit/src/core/adapter-utils.js +++ b/packages/kit/src/core/adapter-utils.js @@ -3,12 +3,13 @@ * * This is intended to be used with both requests and responses, to have a consistent body parsing across adapters. * - * @param {string} content_type The `content-type` header of a request/response. + * @param {string?} content_type The `content-type` header of a request/response. * @returns {boolean} */ export function isContentTypeTextual(content_type) { + if (!content_type) return true; // defaults to json + const [type] = content_type.split(';'); // get the mime type return ( - !content_type || // defaults to json content_type === 'text/plain' || content_type === 'application/json' || content_type === 'application/x-www-form-urlencoded' ||