<?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: Henrique</title>
    <description>The latest articles on DEV Community by Henrique (@hbfigueiredo).</description>
    <link>https://dev.to/hbfigueiredo</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%2F2797688%2F41bf68b0-0740-41a4-94e0-91f4f5415ae4.png</url>
      <title>DEV Community: Henrique</title>
      <link>https://dev.to/hbfigueiredo</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/hbfigueiredo"/>
    <language>en</language>
    <item>
      <title>403 error &lt;Bad state: Cannot access the body fields of a Request without content-type "application/x-www-form-urlencoded".&gt;</title>
      <dc:creator>Henrique</dc:creator>
      <pubDate>Fri, 31 Jan 2025 16:21:15 +0000</pubDate>
      <link>https://dev.to/hbfigueiredo/403-error-bad-state-cannot-access-the-body-fields-of-a-request-without-content-type-37e9</link>
      <guid>https://dev.to/hbfigueiredo/403-error-bad-state-cannot-access-the-body-fields-of-a-request-without-content-type-37e9</guid>
      <description>&lt;p&gt;Calling an external api for user authentication and build a graphql client&lt;br&gt;
Try to use request, with jsonEncode:  &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  final response = await http.post(
    url,
    headers: {
      "Content-type": 'application/x-www-form-urlencoded',
      "accept": "application/json",
    },
    body: jsonEncode({
      "username": username,
      "password": password,
      "plataforma": plataforma,
    }),
  );
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;and, without jsonEncode&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  final response = await http.post(
    url,
    headers: {
    'pragma': 'no-cache',
    'cache-control': 'no-cache',
    'cookie': 'signInPanel..signInForm..$username'
    },
    body: ({
      "username": username,
      "password": password,
      "plataforma": plataforma,
    }),
  );
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;in both options, triggerd error  &lt;br&gt;
Apreciate some help.&lt;/p&gt;

</description>
      <category>flutter</category>
    </item>
  </channel>
</rss>
