React Native SDK - networkRequest method
Records a network request manually. Use it for requests that patchNetwork() doesn’t see, such as requests made from native code or by a custom client.
Signature
Section titled Signatureimport OR from '@openreplay/react-native'
OR.tracker.networkRequest(
'https://api.example.com/users',
'POST',
JSON.stringify({ headers: {}, body: { username: 'demo' } }),
JSON.stringify({ headers: {}, body: { id: 1, username: 'demo' } }),
201,
150
)
Parameters
Section titled Parametersurl: string: The request URL.method: 'GET' | 'POST' | 'PUT' | 'DELETE': The HTTP method.requestJSON: string: JSON string with the request data, in the shape{ headers, body }thatpatchNetwork()sends.responseJSON: string: JSON string with the response data, in the same{ headers, body }shape.status: number: The HTTP status code.duration: number: The request duration in milliseconds.
Nothing is sanitized here: strip secrets from headers and bodies before passing them.
Return value
Section titled Return valueThis method doesn’t return any values, the request will be visible in the replay’s network tab.
Have questions?
Section titled Have questions?If you have any questions about this process, feel free to reach out to us on our Slack .