[chore] minor simplification of `parse_body`
MODIFY
packages/kit/src/runtime/server/parse_body/index.js
packages/kit/src/runtime/server/parse_body/index.js
@@ -5,9 +5,8 @@ import { read_only_form_data } from './read_only_form_data.js';
* @param {import('types/helper').Headers} headers
*/
export function parse_body(raw, headers) {
- if (!raw) return raw;
+ if (!raw || typeof raw !== 'string') return raw;
- if (typeof raw === 'string') {
const [type, ...directives] = headers['content-type'].split(/;\s*/);
switch (type) {
@@ -30,9 +29,6 @@ export function parse_body(raw, headers) {
}
}
- return raw;
-}
-
/** @param {string} text */
function get_urlencoded(text) {
const { data, append } = read_only_form_data();

[chore] minor simplification of `parse_body` (#2043)