Skip to content

Commit af2adee

Browse files
committed
chore: Release version 0.4.3
- Updated version to 0.4.3 in mix.exs - Added comprehensive changelog for 0.4.3 - Updated README.md with new HTTP.Headers features - Added documentation for set_default/3 and user_agent/0 methods - Documented automatic User-Agent header functionality
1 parent a4469fd commit af2adee

File tree

3 files changed

+42
-1
lines changed

3 files changed

+42
-1
lines changed

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,24 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.4.3] - 2025-08-01
9+
10+
### Added
11+
- Added `HTTP.Headers.set_default/3` method to set headers only if they don't already exist
12+
- Uses case-insensitive header name matching
13+
- Preserves existing headers when they already contain the specified name
14+
- Added automatic default `User-Agent` header to all HTTP requests
15+
- Format: `Mozilla/5.0 (macOS; aarch64-apple-darwin24.3.0) OTP/27 BEAM/15.2.3 Elixir/1.18.3 http_fetch/0.4.3`
16+
- Includes OS information, system architecture, OTP version, BEAM version, Elixir version, and library version
17+
- Uses dynamic version detection via `Application.spec(:http_fetch, :vsn)`
18+
- Preserves custom `User-Agent` headers when provided
19+
- Added `HTTP.Headers.user_agent/0` method to access the default User-Agent string
20+
21+
### Changed
22+
- Enhanced User-Agent string to include system architecture information
23+
- Refactored User-Agent generation for consistency across the codebase
24+
- Updated default headers handling to use `set_default/3` for better extensibility
25+
826
## [0.4.2] - 2025-08-01
927

1028
### Added

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,29 @@ binary_data = response.body
133133
:ok = HTTP.Response.write_to(response, "/tmp/large-file.zip")
134134
```
135135

136+
### HTTP.Headers
137+
Handle HTTP headers with utilities for parsing, normalizing, and manipulating headers.
138+
139+
```elixir
140+
# Create headers
141+
headers = HTTP.Headers.new([{"Content-Type", "application/json"}])
142+
143+
# Get header value
144+
type = HTTP.Headers.get(headers, "content-type")
145+
146+
# Set header
147+
headers = HTTP.Headers.set(headers, "Authorization", "Bearer token")
148+
149+
# Set header only if not already present
150+
headers = HTTP.Headers.set_default(headers, "User-Agent", "CustomAgent/1.0")
151+
152+
# Access default user agent string
153+
default_ua = HTTP.Headers.user_agent()
154+
155+
# Parse Content-Type
156+
{media_type, params} = HTTP.Headers.parse_content_type("application/json; charset=utf-8")
157+
```
158+
136159
### HTTP.Request
137160
Request configuration struct.
138161

mix.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
defmodule HttpFetch.MixProject do
22
use Mix.Project
33

4-
@version "0.4.2"
4+
@version "0.4.3"
55
@source_url "https://github.com/gsmlg-dev/http_fetch"
66

77
def project do

0 commit comments

Comments
 (0)