Skip to main content

Language-independent conformance test suite for multipart/form-data parsing and generation

Project description

Multipart Form-Data Conformance Test Suite

⚠️ EARLY ALPHA - DO NOT USE

This test suite is in very early development and has not been verified against real-world implementations. The test cases, expected results, and tooling may contain errors. Do not rely on this for validating parser conformance until it has been thoroughly reviewed and tested.

A language-independent test suite for validating HTTP multipart/form-data parsers and generators.

Goals

  1. Language-independent - Raw binary test files with JSON metadata
  2. Bidirectional - Test both parsing and generation
  3. Comprehensive - Cover spec requirements, edge cases, and browser variations
  4. Self-describing - Each test case explains what it's testing

Quick Start

Running Tests Against Your Implementation

  1. Iterate through test directories in tests/
  2. For each test:
    • Read headers.json to get the Content-Type header with boundary
    • Read input.raw as binary data (the HTTP request body)
    • Parse using your implementation
    • Compare results against expected in test.json

Test Case Structure

Each test case is a directory containing:

tests/category/NNN-test-name/
├── test.json      # Metadata and expected results
├── headers.json   # HTTP headers (Content-Type with boundary)
└── input.raw      # Raw HTTP body bytes (binary)

Test Categories

Category ID Range Description
basic 001-019 Essential parsing tests
filenames 020-039 Filename parameter handling
boundaries 040-059 Boundary detection and edge cases
line-endings 060-079 CRLF/LF handling
content-types 080-099 Content-Type and header parsing
edge-cases 100-199 Unusual but valid scenarios
malformed 200-299 Invalid input error handling
browser-variations 300-399 Real browser output patterns

File Formats

test.json

{
  "id": "001-single-text-field",
  "name": "Single text field",
  "description": "Basic test with one text form field",
  "spec_references": ["RFC 7578 Section 4.2"],
  "category": "basic",
  "tags": ["required", "parsing"],
  "expected": {
    "valid": true,
    "parts": [
      {
        "name": "username",
        "filename": null,
        "content_type": null,
        "body_text": "john_doe"
      }
    ]
  }
}

headers.json

{
  "content-type": "multipart/form-data; boundary=----TestBoundary123"
}

input.raw

Binary file containing exact HTTP body bytes. Use a hex editor or the provided tools to inspect.

Tools

  • tools/generate-raw.py - Create .raw files programmatically
  • tools/validate-suite.py - Validate test suite integrity
  • tools/run-reference.py - Reference parser implementation

Spec References

  • RFC 7578 - Returning Values from Forms: multipart/form-data
  • RFC 2046 - MIME Part Two: Media Types (multipart definition)
  • RFC 5987 - Character Set and Language Encoding (filename*)
  • HTML Living Standard - Form submission

License

This test suite is released under the MIT License. See LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

multipart_form_data_conformance-0.1a0.tar.gz (19.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

multipart_form_data_conformance-0.1a0-py3-none-any.whl (85.7 kB view details)

Uploaded Python 3

File details

Details for the file multipart_form_data_conformance-0.1a0.tar.gz.

File metadata

File hashes

Hashes for multipart_form_data_conformance-0.1a0.tar.gz
Algorithm Hash digest
SHA256 60d06e38cedd7dbf272ca84742d9b9428da5e7fdebb9b75ee41b1a043d5e2824
MD5 40dbdcf7f1c0f52902ba19ccad2dc57d
BLAKE2b-256 606534b50d307b2f764553b1961945c89e6baff9e35c14b2687d3c08f4b65980

See more details on using hashes here.

Provenance

The following attestation bundles were made for multipart_form_data_conformance-0.1a0.tar.gz:

Publisher: publish.yml on simonw/multipart-form-data-conformance

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file multipart_form_data_conformance-0.1a0-py3-none-any.whl.

File metadata

File hashes

Hashes for multipart_form_data_conformance-0.1a0-py3-none-any.whl
Algorithm Hash digest
SHA256 9250810800cb227da5bd4ae0a61cd7d92595f92968125dec3ee7c97b6cc37029
MD5 c4b380e9428b381eadb6352b95f66fdc
BLAKE2b-256 3f186cb98310b7cb1f12843b54cbf639f96cc39c10ceec0f13a36de83e62c572

See more details on using hashes here.

Provenance

The following attestation bundles were made for multipart_form_data_conformance-0.1a0-py3-none-any.whl:

Publisher: publish.yml on simonw/multipart-form-data-conformance

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page