Skip to content

Commit b68cbcd

Browse files
author
Sefa Ilkimen
committed
replace all typeof calls
1 parent a9bdca2 commit b68cbcd

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

www/advanced-http.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ var publicInterface = {
6767
throw new Error(messages.ADDING_COOKIES_NOT_SUPPORTED);
6868
}
6969

70-
if (typeof value !== 'string') {
70+
if (helpers.getTypeOf(value) !== 'String') {
7171
throw new Error(messages.HEADER_VALUE_MUST_BE_STRING);
7272
}
7373

www/helpers.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ var validSerializers = ['urlencoded', 'json', 'utf8' ];
66

77
module.exports = {
88
b64EncodeUnicode: b64EncodeUnicode,
9+
getTypeOf: getTypeOf,
910
checkHeaders: checkHeaders,
1011
onInvalidHeader: onInvalidHeader,
1112
checkSerializer: checkSerializer,
@@ -45,7 +46,7 @@ function checkHeaders(headers) {
4546
for (var i = 0; i < keys.length; i++) {
4647
key = keys[i];
4748

48-
if (typeof headers[key] !== 'string') {
49+
if (getTypeOf(headers[key]) !== 'String') {
4950
return false;
5051
}
5152
}

0 commit comments

Comments
 (0)