electron-fetch
Advanced tools
Comparing version 1.5.0 to 1.6.0
@@ -7,2 +7,6 @@ | ||
## V1.6.0 | ||
- Add option `useSessionCookies` to use session cookies when running on Electron >=7 (thanks @taratatach) | ||
- Update all dependencies | ||
## V1.5.0 | ||
@@ -9,0 +13,0 @@ - Fix requests with empty stream as body & tests on electron >= 7 (thanks @taratatach) |
@@ -107,2 +107,3 @@ import { Readable, Stream } from 'stream' | ||
useElectronNet?: boolean | ||
useSessionCookies?: boolean | ||
// When running on Electron behind an authenticated HTTP proxy, username to use to authenticate | ||
@@ -138,2 +139,4 @@ user?: string | ||
useElectronNet: boolean | ||
// (/!\ only works when running on Electron) | ||
useSessionCookies?: boolean | ||
@@ -140,0 +143,0 @@ //////////////////////////////////////////////////////////////////////////// |
@@ -1151,2 +1151,6 @@ import { parse, format, resolve } from 'url'; | ||
if (this.useElectronNet) { | ||
this.useSessionCookies = init.useSessionCookies !== undefined ? init.useSessionCookies : input.useSessionCookies; | ||
} | ||
if (init.body != null) { | ||
@@ -1286,3 +1290,4 @@ const contentType = extractContentType(this); | ||
delete options.headers; | ||
options.session = opts.session || electron.session.defaultSession; // we have to use a persistent session here, because of https://github.com/electron/electron/issues/13587 | ||
options.session = opts.session || electron.session.defaultSession; | ||
options.useSessionCookies = request.useSessionCookies; | ||
} else { | ||
@@ -1394,3 +1399,4 @@ if (opts.agent) options.agent = opts.agent; | ||
timeout: request.timeout, | ||
useElectronNet: request.useElectronNet | ||
useElectronNet: request.useElectronNet, | ||
useSessionCookies: request.useSessionCookies | ||
}; // HTTP-network fetch step 16.1.2 | ||
@@ -1397,0 +1403,0 @@ |
@@ -1181,2 +1181,6 @@ 'use strict'; | ||
if (this.useElectronNet) { | ||
this.useSessionCookies = init.useSessionCookies !== undefined ? init.useSessionCookies : input.useSessionCookies; | ||
} | ||
if (init.body != null) { | ||
@@ -1316,3 +1320,4 @@ const contentType = extractContentType(this); | ||
delete options.headers; | ||
options.session = opts.session || electron.session.defaultSession; // we have to use a persistent session here, because of https://github.com/electron/electron/issues/13587 | ||
options.session = opts.session || electron.session.defaultSession; | ||
options.useSessionCookies = request.useSessionCookies; | ||
} else { | ||
@@ -1424,3 +1429,4 @@ if (opts.agent) options.agent = opts.agent; | ||
timeout: request.timeout, | ||
useElectronNet: request.useElectronNet | ||
useElectronNet: request.useElectronNet, | ||
useSessionCookies: request.useSessionCookies | ||
}; // HTTP-network fetch step 16.1.2 | ||
@@ -1427,0 +1433,0 @@ |
{ | ||
"name": "electron-fetch", | ||
"version": "1.5.0", | ||
"version": "1.6.0", | ||
"description": "A light-weight module that brings window.fetch to electron's background process", | ||
@@ -45,3 +45,3 @@ "main": "lib/index.js", | ||
"devDependencies": { | ||
"@babel/core": "^7.11.1", | ||
"@babel/core": "^7.11.4", | ||
"@babel/preset-env": "^7.11.0", | ||
@@ -56,3 +56,3 @@ "@babel/register": "^7.10.5", | ||
"cross-env": "^7.0.2", | ||
"electron": "^9.2.0", | ||
"electron": "^10.0.0", | ||
"electron-mocha": "^9.1.0", | ||
@@ -69,8 +69,8 @@ "form-data": "^3.0.0", | ||
"resumer": "0.0.0", | ||
"rollup": "^2.26.3", | ||
"rollup": "^2.26.5", | ||
"rollup-plugin-babel": "^4.4.0", | ||
"standard": "^14.3.4", | ||
"ts-node": "^8.10.2", | ||
"typescript": "^3.9.7", | ||
"whatwg-url": "^8.1.0", | ||
"ts-node": "^9.0.0", | ||
"typescript": "^4.0.2", | ||
"whatwg-url": "^8.2.0", | ||
"xvfb-maybe": "^0.2.1" | ||
@@ -77,0 +77,0 @@ }, |
@@ -40,3 +40,3 @@ | ||
- Removed node-fetch specific options, such as `compression`. | ||
- Added electron-specific option to specify the `Session`. | ||
- Added electron-specific options to specify the `Session` & to enable using cookies from it. | ||
- Added electron-specific option `useElectronNet`, which can be set to false when running on Electron in order to behave as Node.js. | ||
@@ -202,2 +202,3 @@ - Removed possibility to use custom Promise implementation (it's 2018, `Promise` is available everywhere!). | ||
useElectronNet: true, // When running on Electron, defaults to true. On Node.js, defaults to false and cannot be set to true. | ||
useSessionCookies: true, // (/!\ only works when running on Electron >= 7) Whether or not to automatically send cookies from session., | ||
user: undefined, // When running on Electron behind an authenticated HTTP proxy, username to use to authenticate | ||
@@ -244,2 +245,3 @@ password: undefined // When running on Electron behind an authenticated HTTP proxy, password to use to authenticate | ||
- `useElectronNet` (/!\ only works when running on Electron, throws when set to true on Node.js) | ||
- `useSessionCookies` (/!\ only works when running on Electron >= 7) | ||
@@ -246,0 +248,0 @@ See [options](#fetch-options) for exact meaning of these extensions. |
108116
2533
400