Skip to content

refactor: replace direct hasOwnProperty calls#9

Open
deepsource-autofix[bot] wants to merge 1 commit into
v1.xfrom
deepsource-autofix-28e6af5e
Open

refactor: replace direct hasOwnProperty calls#9
deepsource-autofix[bot] wants to merge 1 commit into
v1.xfrom
deepsource-autofix-28e6af5e

Conversation

@deepsource-autofix

Copy link
Copy Markdown

This PR refactors the code to avoid calling built-in methods directly on objects. Each instance of obj.hasOwnProperty(key) has been replaced with Object.prototype.hasOwnProperty.call(obj, key) to ensure a safe, reliable property check regardless of an object’s prototype state.

  • Object.prototype builtins should not be used directly: The existing code invoked hasOwnProperty directly on objects like headers and expectedHeaders, which can lead to incorrect behavior if those objects have a null prototype or an overridden method. We updated all three occurrences to use Object.prototype.hasOwnProperty.call(obj, key), safeguarding against prototype pollution and ensuring consistent behavior.

This Autofix was generated by AI. Please review the change before merging.

This PR refactors the code to avoid calling built-in methods directly on objects. Each instance of `obj.hasOwnProperty(key)` has been replaced with `Object.prototype.hasOwnProperty.call(obj, key)` to ensure a safe, reliable property check regardless of an object’s prototype state.

- Object.prototype builtins should not be used directly: The existing code invoked `hasOwnProperty` directly on objects like `headers` and `expectedHeaders`, which can lead to incorrect behavior if those objects have a null prototype or an overridden method. We updated all three occurrences to use `Object.prototype.hasOwnProperty.call(obj, key)`, safeguarding against prototype pollution and ensuring consistent behavior.

> This Autofix was generated by AI. Please review the change before merging.
@deepsource-io

deepsource-io Bot commented Oct 7, 2025

Copy link
Copy Markdown

Here's the code health analysis summary for commits 1339402..3734b7b. View details on DeepSource ↗.

Analysis Summary

AnalyzerStatusSummaryLink
DeepSource JavaScript LogoJavaScript✅ SuccessView Check ↗

💡 If you’re a repository administrator, you can configure the quality gates from the settings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants