@@ -89,7 +89,10 @@ export function createBodyParser(opts = {}) {
8989 strict : true ,
9090 returnRawBody : false ,
9191 } ) ;
92- } else if ( opts . urlencoded && ctx . is ( "urlencoded" ) ) {
92+ } else if (
93+ opts . urlencoded &&
94+ ctx . is ( "application/x-www-form-urlencoded" )
95+ ) {
9396 bodyResult = await coBody . form ( ctx , {
9497 encoding : opts . encoding ,
9598 limit : opts . urlencodedLimit ,
@@ -126,13 +129,17 @@ export function createBodyParser(opts = {}) {
126129 } catch ( /** @type {any } */ parsingError ) {
127130 if ( parsingError instanceof SyntaxError ) {
128131 delete parsingError . stack ;
129- throw AppError . validationError ( "error.server.unsupportedBodyFormat" , {
130- name : parsingError . name ,
131- message : parsingError . message ,
132+ throw AppError . validationError (
133+ "error.server.unsupportedBodyFormat" ,
134+ {
135+ name : parsingError . name ,
136+ message : parsingError . message ,
132137
133- // @ts -ignore
134- rawBody : parsingError . body ,
135- } ) ;
138+ // @ts -ignore
139+ rawBody : parsingError . body ,
140+ } ,
141+ parsingError ,
142+ ) ;
136143 } else if ( parsingError . message ?. includes ( "exceeded, received" ) ) {
137144 throw AppError . validationError (
138145 "error.server.maxFieldSize" ,
0 commit comments