Skip to content

Releases: coenttb/swift-form-coding

Version 0.3.0

06 Aug 19:02

Choose a tag to compare

🐛 Bug Fixes

  • Fixed empty request body issue in Multipart.Conversion
  • Fixed URL decoding to properly handle both keys and values
  • Fixed URL decoding order (percent encoding before + to space conversion)

🔒 Security Improvements

  • Added header injection protection with field name/filename sanitization
  • Enhanced boundary generation using UUID (45 chars vs 15 chars)
  • Added CR/LF and quote escaping in multipart headers

⚠️ Error Handling

  • Multipart.Conversion.unapply now throws descriptive errors instead of returning empty data
  • Added InvalidUTF8Error and InvalidFieldDataError types
  • Improved error diagnostics throughout

⚡ Performance

  • Optimized string concatenation for multipart body generation
  • More efficient Data appending operations

✅ Testing

  • Added comprehensive error handling tests
  • Added special character encoding tests
  • All 106 tests passing
  • Improved test coverage for edge cases

💥 Breaking Changes

  • Multipart.Conversion.unapply now throws errors (was returning empty Data on failure)

Installation

dependencies: [
    .package(url: "https://github.com/coenttb/swift-url-form-coding.git", from: "0.3.0")
]

Version 0.2.0

06 Aug 05:12

Choose a tag to compare

What's Changed

✨ Features & Improvements

  • Consolidated and refactored URLFormCoding tests for better maintainability
  • Improved package structure and dependencies
  • Enhanced multipart form handling capabilities
  • Better conversion implementations for URL routing

🔧 Refactoring

  • Merged separate decoder and encoder test files into unified test suite
  • Removed redundant test files and consolidated test models
  • Cleaner test structure for multipart form handling

📦 Dependencies

  • Updated package dependencies for Swift 6.0 compatibility

Full Changelog: coenttb/swift-url-form-coding@0.1.0...0.2.0

Release 0.0.2

30 Jul 18:57

Choose a tag to compare

What's Changed

  • Add pointfree-url-form-coding dependency
  • README updates
  • PointFreeURLFormCoding integration improvements

Full Changelog: coenttb/swift-url-form-coding@0.0.1...0.0.2

0.0.1 - Initial Release

26 Jul 10:44

Choose a tag to compare

Swift URL Form Coding 0.0.1

Type-safe Swift library for encoding and decoding application/x-www-form-urlencoded data using Swift's Codable protocol.

Features

  • Type-safe: Full Swift Codable support for form data
  • Multiple parsing strategies: Support for different form data formats (brackets, indices, accumulate values)
  • Comprehensive: Handles nested objects, arrays, dates, and custom data types
  • Standards compliant: RFC 3986 URL encoding
  • Zero dependencies: Pure Swift implementation
  • Swift 6.0 ready: Includes Swift 6.0 language mode support

Quick Start

import URLFormCoding

struct User: Codable {
    let name: String
    let age: Int
    let isActive: Bool
}

let encoder = URLFormEncoder()
let decoder = URLFormDecoder()

// Encode to form data
let user = User(name: "John Doe", age: 30, isActive: true)
let formData = try encoder.encode(user)
// Result: "name=John%20Doe&age=30&isActive=true"

// Decode from form data
let decoded = try decoder.decode(User.self, from: formData)

Package Integration

For URLRouting integration, see swift-url-routing.

Full Changelog: https://github.com/coenttb/swift-url-form-coding/commits/0.0.1