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', () => {
10
10
expect ( body ) . toEqual ( json ) ;
11
11
} ) ;
12
12
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
+
13
20
it ( 'Parses form url encoded body' , ( ) => {
14
21
const form = { hello : 'world' } ;
15
22
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 {
54
54
}
55
55
56
56
private isJSON ( contentType : string ) : boolean {
57
- return contentType && contentType . toUpperCase ( ) === 'APPLICATION/JSON' ;
57
+ return contentType && contentType . toUpperCase ( ) . includes ( 'APPLICATION/JSON' ) ;
58
58
}
59
59
}
You can’t perform that action at this time.
0 commit comments