<h3 dir="auto">Preflight Checklist</h3>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have read the <a href="https://github.com/electron/electron/blob/master/CONTRIBUTING.md">Contributing Guidelines</a> for this project.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I agree to follow the <a href="https://github.com/electron/electron/blob/master/CODE_OF_CONDUCT.md">Code of Conduct</a> that this project adheres to.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have searched the <a href="https://www.github.com/electron/electron/issues">issue tracker</a> for a feature request that matches the one I want to file, without success.</li>
</ul>
<h3 dir="auto">Electron Version</h3>
<p dir="auto">12.0.6</p>
<h3 dir="auto">What operating system are you using?</h3>
<p dir="auto">Windows</p>
<h3 dir="auto">Operating System Version</h3>
<p dir="auto">windows 10</p>
<h3 dir="auto">What arch are you using?</h3>
<p dir="auto">x64</p>
<h3 dir="auto">Last Known Working Electron version</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">Expected Behavior</h3>
<p dir="auto">Hi,</p>
<p dir="auto">The response header set-cookie is not present in the response. Pls check the below code. you can directly execute the code because url is used in the code has been exposed for public usage.</p>
<p dir="auto">Code :</p>
<p dir="auto">const { app, BrowserWindow } = require('electron');<br>
let mainWindow;<br>
app.commandLine.appendSwitch('ignore-certificate-errors', 'true');</p>
<p dir="auto">app.whenReady().then(() =&gt; {<br>
const { net } = require('electron')<br>
var option = {<br>
method: "POST",<br>
uri: "<a href="http://testhtml5.vulnweb.com/login" rel="nofollow">http://testhtml5.vulnweb.com/login</a>",<br>
headers: {<br>
"Content-Type": "application/x-www-form-urlencoded"<br>
},<br>
body: "username=admin&amp;password=",<br>
redirect: "manual",<br>
useSessionCookies: true,<br>
credentials: "include"<br>
}<br>
const request = net.request(option)<br>
request.on('response', (response) =&gt; {<br>
console.log(response.statusCode);<br>
response.on('data', (chunk) =&gt; {<br>
//console.log(<code class="notranslate">BODY: ${chunk}</code>)<br>
})<br>
response.on('end', () =&gt; {<br>
})<br>
})<br>
request.on("redirect", (statusCode, method, redirectUrl, responseHeaders) =&gt; {<br>
if (option.redirect == "follow") {<br>
request.followRedirect();<br>
} else {<br>
console.log(responseHeaders["Set-Cookie"]);<br>
request.abort();<br>
}<br>
});<br>
request.write(option.body || "");<br>
request.end()<br>
})</p>
<p dir="auto">Ouptput is undefined. But i can assure you that set-cookie is exposed on response while using browser.  I have attached a browser screenshot.</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/57345061/117121846-ccff4f00-adb2-11eb-80a6-d3e19fcbd879.png"><img src="https://user-images.githubusercontent.com/57345061/117121846-ccff4f00-adb2-11eb-80a6-d3e19fcbd879.png" alt="image" style="max-width: 100%;"></a></p>
<p dir="auto">Please let me know if you need further inputs.</p>
<h3 dir="auto">Actual Behavior</h3>
<p dir="auto">set-cookie is not exposed on response header.</p>
<h3 dir="auto">Testcase Gist URL</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">Additional Information</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">Preflight Checklist</h3>

<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have read the <a href="https://github.com/electron/electron/blob/master/CONTRIBUTING.md">Contributing Guidelines</a> for this project.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I agree to follow the <a href="https://github.com/electron/electron/blob/master/CODE_OF_CONDUCT.md">Code of Conduct</a> that this project adheres to.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have searched the issue tracker for an issue that matches the one I want to file, without success.</li>
</ul>
<h3 dir="auto">Issue Details</h3>
<ul dir="auto">
<li><strong>Electron Version:</strong>
<ul dir="auto">
<li>
 v9.0.0
</li>
</ul>
</li>
<li><strong>Operating System:</strong>
<ul dir="auto">
<li>
 macOS 10.15.5
</li>
</ul>
</li>
<li><strong>Last Known Working Electron version:</strong>
<ul dir="auto">
<li>
 5.x.y
</li>
</ul>
</li>
</ul>
<h3 dir="auto">Expected Behavior</h3>

<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="request.on('redirect', (statusCode, method, redirectUrl, responseHeaders) =&gt; {
  console.log(responseHeaders['set-cookie']); // should not be undefined
});"><pre class="notranslate"><span class="pl-s1">request</span><span class="pl-kos">.</span><span class="pl-en">on</span><span class="pl-kos">(</span><span class="pl-s">'redirect'</span><span class="pl-kos">,</span> <span class="pl-kos">(</span><span class="pl-s1">statusCode</span><span class="pl-kos">,</span> <span class="pl-s1">method</span><span class="pl-kos">,</span> <span class="pl-s1">redirectUrl</span><span class="pl-kos">,</span> <span class="pl-s1">responseHeaders</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-kos">{</span>
  <span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s1">responseHeaders</span><span class="pl-kos">[</span><span class="pl-s">'set-cookie'</span><span class="pl-kos">]</span><span class="pl-kos">)</span><span class="pl-kos">;</span> <span class="pl-c">// should not be undefined</span>
<span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<h3 dir="auto">Actual Behavior</h3>

<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="request.on('redirect', (statusCode, method, redirectUrl, responseHeaders) =&gt; {
  console.log(responseHeaders['set-cookie']); // is undefined no matter what
});"><pre class="notranslate"><span class="pl-s1">request</span><span class="pl-kos">.</span><span class="pl-en">on</span><span class="pl-kos">(</span><span class="pl-s">'redirect'</span><span class="pl-kos">,</span> <span class="pl-kos">(</span><span class="pl-s1">statusCode</span><span class="pl-kos">,</span> <span class="pl-s1">method</span><span class="pl-kos">,</span> <span class="pl-s1">redirectUrl</span><span class="pl-kos">,</span> <span class="pl-s1">responseHeaders</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-kos">{</span>
  <span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s1">responseHeaders</span><span class="pl-kos">[</span><span class="pl-s">'set-cookie'</span><span class="pl-kos">]</span><span class="pl-kos">)</span><span class="pl-kos">;</span> <span class="pl-c">// is undefined no matter what</span>
<span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<h3 dir="auto">To Reproduce</h3>

<p dir="auto">I've put together a small proof of concept using the electron-quick-start demo found <a href="https://github.com/walmat/electron-quick-start">here</a>.</p>
<p dir="auto">To run the example:</p>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="git clone https://github.com/walmat/electron-quick-start.git &amp;&amp; yarn &amp;&amp; yarn start"><pre class="notranslate">git clone https://github.com/walmat/electron-quick-start.git <span class="pl-k">&amp;&amp;</span> yarn <span class="pl-k">&amp;&amp;</span> yarn start</pre></div>



<h3 dir="auto">Screenshots</h3>

<h3 dir="auto">Additional Information</h3>