Skip to content

Commit af4a581

Browse files
authored
Merge pull request #430 from Pritilender/master
Fix `hasOwnProperty is not a function` error
2 parents 234847a + ad7c3f2 commit af4a581

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/request.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@ function Request(options) {
3333

3434
// Store the headers in lower case.
3535
for (var field in options.headers) {
36-
if (options.headers.hasOwnProperty(field)) {
36+
if (Object.prototype.hasOwnProperty.call(options.headers, field)) {
3737
this.headers[field.toLowerCase()] = options.headers[field];
3838
}
3939
}
4040

4141
// Store additional properties of the request object passed in
4242
for (var property in options) {
43-
if (options.hasOwnProperty(property) && !this[property]) {
43+
if (Object.prototype.hasOwnProperty.call(options, property) && !this[property]) {
4444
this[property] = options[property];
4545
}
4646
}

lib/response.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ function Response(options) {
1313

1414
// Store the headers in lower case.
1515
for (var field in options.headers) {
16-
if (options.headers.hasOwnProperty(field)) {
16+
if (Object.prototype.hasOwnProperty.call(options.headers, field)) {
1717
this.headers[field.toLowerCase()] = options.headers[field];
1818
}
1919
}
2020

2121
// Store additional properties of the response object passed in
2222
for (var property in options) {
23-
if (options.hasOwnProperty(property) && !this[property]) {
23+
if (Object.prototype.hasOwnProperty.call(options, property) && !this[property]) {
2424
this[property] = options[property];
2525
}
2626
}

0 commit comments

Comments
 (0)