how to modify the value of the key 'X-requested-with' in the request headers of resource request in Android webview, but not a page request?

前端 未结 1 1008
小鲜肉
小鲜肉 2021-01-03 09:02

I have met a problem when I capture the http package when my webView visit a url. the package shows that the request send by ajax has a \'X-requested-with\' key in the heade

相关标签:
1条回答
  • 2021-01-03 09:21

    well, finally I solve the question. I can't find out the way to modify the headers in the request send by ajax in an loading page still, but I chose to override public String getPackageName() in Application. I look up the callingstack, if the calling comes from android.webkit, I return another string instead of my package name. So my issues solved. But the basic question still leaves.

    0 讨论(0)
提交回复
热议问题