File tree 4 files changed +4
-3
lines changed
4 files changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ unreleased
15
15
- Use ` http-errors ` for standard emitted errors
16
16
17
17
18
+ * perf: prevent internal ` throw ` when missing charset
18
19
19
20
1.17.2 / 2017-05-17
20
21
===================
Original file line number Diff line number Diff line change @@ -154,7 +154,7 @@ function firstchar (str) {
154
154
155
155
function getCharset ( req ) {
156
156
try {
157
- return contentType . parse ( req ) . parameters . charset . toLowerCase ( )
157
+ return ( contentType . parse ( req ) . parameters . charset || '' ) . toLowerCase ( )
158
158
} catch ( e ) {
159
159
return undefined
160
160
}
Original file line number Diff line number Diff line change @@ -101,7 +101,7 @@ function text (options) {
101
101
102
102
function getCharset ( req ) {
103
103
try {
104
- return contentType . parse ( req ) . parameters . charset . toLowerCase ( )
104
+ return ( contentType . parse ( req ) . parameters . charset || '' ) . toLowerCase ( )
105
105
} catch ( e ) {
106
106
return undefined
107
107
}
Original file line number Diff line number Diff line change @@ -171,7 +171,7 @@ function extendedparser (options) {
171
171
172
172
function getCharset ( req ) {
173
173
try {
174
- return contentType . parse ( req ) . parameters . charset . toLowerCase ( )
174
+ return ( contentType . parse ( req ) . parameters . charset || '' ) . toLowerCase ( )
175
175
} catch ( e ) {
176
176
return undefined
177
177
}
You can’t perform that action at this time.
0 commit comments