How to get URI of a webview from vscode extension - visual-studio-code

Is there a way to get uri of a webview?
vscode.WebviewPanel or vscode.WebviewPanel.webview don't have Uri property.
We have implemented vscode.FileDecorationProvider and provideFileDecoration gets called with uri of the webview. It is in the format 'webview-panel:webview-panel/webview-0fcc2c60-ca8a-4076-b0a6-9be1ccea8915'
But could not find a way to get this uri from vscode.WebviewPanel.

Related

How do I return a custom response to a Fetch request from Flutter InAppWebView?

I have a mobile flutter app that uses a flutter_inappwebview. In the webview, I have a mapbox-gl script to display a map. When requesting sprites, the script will make a fetch request to "https://content/sprite/sprite#2x.json", which I am able to capture using shouldInterceptFetchRequest. I would like the response to this request to contain a custom json file that I generate in my code.
In native Android, I am familiar with shouldInterceptRequest, which allows me to return a custom web resource response. However, the shouldInterceptFetchRequest in flutter_inappwebview requires me to return a FetchRequest. It seems the intent of shouldOverrideFetchRequest is to change the request before sending it from within the webview. Instead, I would like to create my own response, similar to the native Android method.
How do I supply a custom response to an inappwebview fetch request?

Flutter Web - Can't change GET request's referer in header

I'm trying to call a GET request using chopper with a custom referer. But everytime it calls, it only uses the default referer. I added a custom header and it still works
You can not change referrer programmatically. please refer this web page : https://developer.mozilla.org/en-US/docs/Glossary/Forbidden_header_name
A forbidden header name is the name of any HTTP header that cannot be
modified programmatically; specifically,

Swift - Check if responsive or native app

I created a responsive app and a native app: the native app is basically just a UIWebView containing the responsive app.
How can i check on server side (php, etc..) where the request comes from?
Is there any possibility to modifiy requests sent from UIWebView or something else?
I see two possible approaches:
URL parameter
You could have a parameter in your URL to indicate the source of the request.
For instance, if the URL if your web app is
http://myserver.com/mypath
you could use the following URL in your native app's UIWebView:
http://myserver.com/mypath?src=native
On server side, you can retrieve this paramerer, e.g in PHP:
$src = $_GET['src'];
if ($src == 'native') {
// Request from native app
}
If your app has multiple pages, then you should modify the way your links are created to propagate this parameter when navigating from one page to another one.
Cookie
In the native app, you could manually set a custom cookie which would be sent along your requests and which you would retrieve on server side.
The following post may help you for that: Is it possible to set a cookie manually using sharedHTTPCookieStorage for a UIWebView?

Cannot set HTTP request body

Can anyone tell me how to send a file to server and a username. I tried to set HTTP body with the content of the file and use GET method to set username but it doesn't work and encounter the exact situation as this post:( this is a bug) :
NSURLRequest cannot handle HTTP body when method is not POST?
As the post says, can anyone show me how to use PUT method as in both the ios client and php server or show me another method ?

Zend Based REST URI for POST and PUT methods

This post if a follow-up question to mt previous post:
Android RESTful Web application using Zend Framework
I have written a web application which is based on the Zend Framework (Version 1.11.11) and I want to use the SAME backend code for coding the mobile version of this application (Android). To achieve this, I want to get the response for each of the actions in the controllers in XML and JSON - for mobile-based app.
Using the answers provided in the above link, I am able to get the XML and JSON response by making use of the AjaxContext helper. I set the contexts as json for the required actions in the init method and I am getting the desired json response.
Now I have another challenge. How to know from the URL if the given action was a GET or a POST request? Do I have have to add that as a query parameter? Is that the correct way?
For example, for login action within User controller: URL will be: [link] (http://localhost/user/login)
But within the loginAction, I check if the given request if a post and authenticate only if the request is a post. So the URL: http://localhost/user/login?format=xml will always return to me the response for a GET request since there is no way of knowing if the request was a GET or POST. Please help.
Thanks.
Abhilash
like you added format parameter do the same for request . Use "method" parameter to decide what type of request is it . Or you can also do is
$this->getRequest()->isPost(); //create
$this->getRequest()->isGet(); //read
$this->getRequest()->isPut(); // update
$this->getRequest()->isDelete(); // delete