File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,13 @@ describe('Body parsing', () => {
1010 expect ( body ) . toEqual ( json ) ;
1111 } ) ;
1212
13+ it ( 'Parses json body when charset is also defined in the context-type' , ( ) => {
14+ const json = { hello : 'world' } ;
15+ const headers = { 'content-type' : 'application/json;charset=UTF-8' } ;
16+ const body = new Body ( JSON . stringify ( json ) , headers ) . getParsedBody ( ) ;
17+ expect ( body ) . toEqual ( json ) ;
18+ } ) ;
19+
1320 it ( 'Parses form url encoded body' , ( ) => {
1421 const form = { hello : 'world' } ;
1522 const headers = { 'content-type' : 'application/x-www-form-urlencoded' } ;
Original file line number Diff line number Diff line change @@ -54,6 +54,6 @@ export class Body {
5454 }
5555
5656 private isJSON ( contentType : string ) : boolean {
57- return contentType && contentType . toUpperCase ( ) === 'APPLICATION/JSON' ;
57+ return contentType && contentType . toUpperCase ( ) . includes ( 'APPLICATION/JSON' ) ;
5858 }
5959}
You can’t perform that action at this time.
0 commit comments