lineraurora.blogg.se

Electron api request
Electron api request













statusLine string (optional) - Should be provided when overriding responseHeaders to change header status otherwise original response header's status will be used.

electron api request

responseHeaders Record (optional) - When provided, the server is assumed to have responded with these headers.The listener will be called with listener(details) just before a request is going to be sent to the server, modifications of previous onBeforeSendHeaders response are visible by the time this listener is fired. The callback has to be called with an response object. The uploadData is an array of UploadData objects. The listener will be called with listener(details, callback) when a request is about to occur. redirectURL string (optional) - The original request is prevented from being sent or completed and is instead redirected to the given URL.resourceType string - Can be mainFrame, subFrame, stylesheet, script, image, font, object, xhr, ping, cspReport, media, webSocket or other.The following methods are available on instances of WebRequest: webRequest.onBeforeRequest(listener) ​ Modify the user agent for all requests to the following urls. If the filter is omitted then all requests will be matched.įor certain events the listener is passed with a callback, which should be called with a response object when listener has done its work.Īn example of adding User-Agent header for requests: The filter object has a urls property which is an Array of URL patterns that will be used to filter out the requests that do not match the URL patterns. Passing null as listener will unsubscribe from the event. ⚠️ Only the last attached listener will be used. The details object describes the request. The listener will be called with listener(details) when the API's event has happened. The methods of WebRequest accept an optional filter and a listener. Instances of the WebRequest class are accessed by using the webRequest property of a Session. It is only available as a return value of other methods in the Electron API. Process: Main This class is not exported from the 'electron' module. Intercept and modify the contents of a request at various stages of its lifetime.















Electron api request