<p dir="auto"><code class="notranslate">fetch('https://httpbin.org/cookies/set?foo=bar', cookies={'foo1':'bar1'}, meta={'dont_merge_cookies': True}, headers={'Cookie':'foor2=bar2'})</code></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="request.cookies
request.headers['cookie']"><pre class="notranslate"><code class="notranslate">request.cookies
request.headers['cookie']
</code></pre></div>
<p dir="auto">is:<br>
{'foo1': 'bar1'}<br>
b'foor2=bar2'</p>
<p dir="auto">but <code class="notranslate">response.text</code>:<br>
{\n  "cookies": {\n    "foor2": "bar2"\n  }\n}\n</p>
<p dir="auto">shouldn't request.cookies been sent with the <code class="notranslate">fetch</code> request?</p>
<p dir="auto">This example is <a href="http://doc.scrapy.org/en/latest/topics/request-response.html#request-objects" rel="nofollow">straight from the documentation</a>, and does not work because if dont_merge_cookies is set on the request, then the cookie middleware skips all cookie processing and no cookies are ever set.</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="Request(url=&quot;http://www.example.com&quot;,
        cookies={'currency': 'USD', 'country': 'UY'},
        meta={'dont_merge_cookies': True})"><pre class="notranslate"><span class="pl-v">Request</span>(<span class="pl-s1">url</span><span class="pl-c1">=</span><span class="pl-s">"http://www.example.com"</span>,
        <span class="pl-s1">cookies</span><span class="pl-c1">=</span>{<span class="pl-s">'currency'</span>: <span class="pl-s">'USD'</span>, <span class="pl-s">'country'</span>: <span class="pl-s">'UY'</span>},
        <span class="pl-s1">meta</span><span class="pl-c1">=</span>{<span class="pl-s">'dont_merge_cookies'</span>: <span class="pl-c1">True</span>})</pre></div>
<p dir="auto">Does not work, however, this does:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="Request(url=&quot;http://www.example.com&quot;,
        cookies={'currency': 'USD', 'country': 'UY'})"><pre class="notranslate"><span class="pl-v">Request</span>(<span class="pl-s1">url</span><span class="pl-c1">=</span><span class="pl-s">"http://www.example.com"</span>,
        <span class="pl-s1">cookies</span><span class="pl-c1">=</span>{<span class="pl-s">'currency'</span>: <span class="pl-s">'USD'</span>, <span class="pl-s">'country'</span>: <span class="pl-s">'UY'</span>})</pre></div>