parseResponse function

dynamic parseResponse(
  1. String response
)

Parses the given response string and checks for connection errors.

Throws an Exception with the message 'TLS Pinning Error' if the response contains 'Connection Error'. Otherwise, returns the original response.

Parameters:

  • response: The response string to be parsed.

Returns:

  • The original response if no connection error is found.

Throws:

  • Exception: If the response contains 'Connection Error'.

Implementation

parseResponse(String response) {
  if (response.contains('Connection Error')) {
    throw Exception('TLS Pinning Error');
  }
  return response;
}