<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Md. Sakil Sazzad Joy</title>
    <description>The latest articles on DEV Community by Md. Sakil Sazzad Joy (@ssjoy).</description>
    <link>https://dev.to/ssjoy</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1106001%2Ff0cc21fe-2c47-4cbe-a880-211f451b6279.jpeg</url>
      <title>DEV Community: Md. Sakil Sazzad Joy</title>
      <link>https://dev.to/ssjoy</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ssjoy"/>
    <language>en</language>
    <item>
      <title>Bug in Postman and Thunder Client Vs Code extensions</title>
      <dc:creator>Md. Sakil Sazzad Joy</dc:creator>
      <pubDate>Sun, 16 Jul 2023 15:04:24 +0000</pubDate>
      <link>https://dev.to/ssjoy/bug-in-postman-and-thunder-client-vs-code-extensions-fgh</link>
      <guid>https://dev.to/ssjoy/bug-in-postman-and-thunder-client-vs-code-extensions-fgh</guid>
      <description>&lt;p&gt;This post is about a tiny bug (correct me if I am wrong) I found in &lt;strong&gt;thunder client and postman vs code extensions&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;We all know about &lt;strong&gt;API testing and cookies&lt;/strong&gt;. and today's post is about a small bug I found when testing my APIs.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;A refresher about how cookies are used:&lt;/strong&gt;&lt;/em&gt;&lt;br&gt;
First, we send a request to a server at an URL. If that server wants to send us cookies, it uses the &lt;strong&gt;Set-Cookie&lt;/strong&gt; header to send us some cookies.&lt;br&gt;
Then every time we send a request to that same domain/server, our cookies are automatically sent to that server. Right?&lt;br&gt;
We/our browsers/clients use the Cookie header in the request for sending their cookies to the server.&lt;/p&gt;

&lt;p&gt;So what's the issue here?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Problem in thunder client vs code extension:(v2.9.1)&lt;/strong&gt;&lt;br&gt;
Now say I am using postman vs code extension to test some API.I sent a request and so I got some cookies from the server. Now every time I send a request to that same server, my cookies are going to be sent as well. Also, they are supposed to be sent using the request &lt;strong&gt;Cookie&lt;/strong&gt; header. Right?&lt;/p&gt;

&lt;p&gt;But It won't. You will not find any Cookie header in the request header in thunder client vs code extension.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Problem in postman vs code extension:(v0.3.0)&lt;/strong&gt;&lt;br&gt;
I have found the same problem in the postman vs code extension.&lt;br&gt;
After getting cookies if you send requests you will not see those cookies in the Cookie header.&lt;/p&gt;

&lt;p&gt;✅UPDATE:Postman has fixed this issue. If you are using &amp;gt;= 0.3.1 you won't find this issue.&lt;/p&gt;

&lt;p&gt;Now this was very confusing. I was a newbie and couldn't figure out why wasn't I sending the cookies in the Cookie header. Cookies are supposed to be sent in the request Cookie header. &lt;br&gt;
Turns out, the cookies will be sent to the server. But, you won't find them in the header.😑&lt;/p&gt;

&lt;p&gt;✨Also One thing I should mention you won't find this issue in the official postman desktop application.&lt;/p&gt;

&lt;p&gt;Now I have made an example explaing the whole thing.If you have the patience follow along.&lt;br&gt;
You can find code and some  usefull screenshots in this github repo(see the Readme file):&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/ss-joy/Cookie-header-problem-post"&gt;https://github.com/ss-joy/Cookie-header-problem-post&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Or you can simply copy paste this code and hit these 2 urls to check the issues:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const express = require("express");
const cookieParser = require("cookie-parser");
const app = express();
app.use(cookieParser());

app.get("/get-some-cookies", (req, res) =&amp;gt; {
  res.cookie("cartoon-name-one", "ben10");
  res.cookie("cartoon-name-two", "mega-xlr");
  res.cookie("cartoon-name-three", "powerpuff girls");
  res.send("Conrats you have some cookies in your response");
});

app.get("/see-some-cookies", (req, res) =&amp;gt; {
  console.log(req.cookies);
  res.send("OK got it");
});

app.listen(3000, () =&amp;gt; {
  console.log("server started @port 3000");
});

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>cookieheader</category>
      <category>postman</category>
      <category>thunderclient</category>
      <category>vscodeextension</category>
    </item>
  </channel>
</rss>
