---
slug: "dart-flutter-の-dio-ライブラリは-httpヘッダーをすべて小文字で送信する"
title: "Dart (Flutter) Dio Library Sends All HTTP Headers in Lowercase"
description: "Dart's `dio` HTTP client lowercases all request header names, which can break authentication against old servers that treat header casing as significant."
url: "https://www.ytyng.com/en/blog/dart-flutter-の-dio-ライブラリは-httpヘッダーをすべて小文字で送信する"
publish_date: "2021-03-20T13:05:57Z"
created: "2021-03-20T13:05:57Z"
updated: "2026-05-11T13:14:23.096Z"
categories: []
keywords: ""
featured_image_url: "https://media.ytyng.com/resize/20230812/337089bb9d7147839469fb64ccbd4f34.png.webp?width=768"
has_video: false
has_music: false
video_urls: []
music_urls: []
lang: "en"
---

# Dart (Flutter) Dio Library Sends All HTTP Headers in Lowercase

<p>Dart (Flutter) dio library</p>
<p><a href="https://pub.dev/packages/dio">https://pub.dev/packages/dio</a></p>
<p>is more convenient compared to other commonly used HTTP libraries because it allows for easy handling of cancellations, GET parameters, timeouts, JSON, etc.</p>
<p></p>
<p>However, in version 3.x, there is an issue where all HTTP headers are sent in lowercase.</p>
<p></p>
<p>In other words,</p>
<pre><span>await </span>Dio().get(<br />  endpointUrl<span>,<br /></span><span>  </span>options: Options(<br />    headers: {<br /><span>      'Authorization': 'xxxxxx'<br />    }<br /></span><span>  </span>)<span>,<br /></span>)<span>;</span></pre>
<p>if you write it like this, the actual header will be <code>authorization: xxxxxx</code>.</p>
<p>Some servers may not recognize the header.</p>
<p></p>
<p></p>
<p><a href="https://github.com/flutterchina/dio/issues/641">https://github.com/flutterchina/dio/issues/641</a></p>
<p>This issue is discussed here, and while the RFC states that headers should be treated case-insensitively, in reality, some server-side implementations may distinguish between cases, making it challenging for such use cases.</p>
<p>However, this might be fixed in the upcoming V 4.0.0, which is currently under a pull request. Let's wait and see.</p>
<p><a href="https://github.com/flutterchina/dio/pull/1082">https://github.com/flutterchina/dio/pull/1082</a></p>
<p></p>
<p>Incidentally, when I switched to the http library and tested, the headers were also converted to lowercase in the same way.</p>
