Skip to content

Instantly share code, notes, and snippets.

@magostinhojr
Last active December 17, 2019 18:26
Show Gist options
  • Save magostinhojr/9c73227c3d82a2941d81ec602a8d8080 to your computer and use it in GitHub Desktop.
Save magostinhojr/9c73227c3d82a2941d81ec602a8d8080 to your computer and use it in GitHub Desktop.
override fun shouldInterceptRequest(
view: WebView?,
request: WebResourceRequest?
): WebResourceResponse? {
return if (request!!.url.path.endsWith("users/login")) {
val url = java.net.URL(request.url.toString())
val connection = url.openConnection()
connection.connect()
val inputStream = connection.getInputStream()
val response = JsonReader(InputStreamReader(inputStream))
return null
} else {
super.shouldInterceptRequest(view, request)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment