Skip to content

Allow to disable interception of XMLHttpRequest #981

@ddeath

Description

@ddeath

I would like to have an option to completely prevent XMLHttpRequest to be intercepted. Current implementation of library will always enable it and then we have option to disable it with NetworkLogger.setEnabled(false)

However this is not ideal because if there are some other modifications to the same object, kind of undefined behaviour can happen. See example bellow.

In order to keep interception enabled by default I would suggest that you could add new option to InstabugConfig which would be true by default and if it would be false, XMLHttpRequest would be kept untouched.

In practice, this line: https://github.com/Instabug/Instabug-React-Native/blob/master/src/modules/Instabug.ts#L90 would be wrapped in IF based on that option.

Steps to Reproduce the Problem

  • Initialize instabug
  • Proxy XMLHttpRequest with custom code
  • Disable interception with NetworkLogger.setEnabled(false)

After these steps your own customization from step #2 is lost.

Expected Behavior

XMLHttpRequest is not proxied at all

Actual Behavior

XMLHttpRequest is first proxied and then original version is restored if it is disabled

SDK Version

11.9.1

React Native, iOS and Android Versions

0.71.8

Device Model

IOS Simulator

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions