Skip to content

Make strict HTTP behavior the default in 1.0 #284

Description

@Mattsface

Make strict HTTP behavior the default in 1.0

Parent release issue: #282

Depends on: #283

Why

Version 0.9.0 introduced strict_http=True as an opt-in migration path. Version 1.0.0 should complete that migration by making strict handling the default for final non-404 4xx responses.

Scope

Change the default constructor behavior so these are equivalent:

mlbstatsapi.Mlb()
mlbstatsapi.Mlb(strict_http=True)

Default behavior must be:

  • Final non-404 4xx responses raise MlbHttpError
  • Final 5xx responses raise MlbHttpError
  • Endpoint-specific 404 behavior remains unchanged
  • Retry exhaustion is handled before the final HTTP decision
  • Timeout, transport, decode, and validation behavior remain unchanged

Compatibility boundaries

This issue must not:

  • Change retry values
  • Make 404 responses strict
  • Reconfigure caller-injected Sessions
  • Change endpoint return models
  • Collapse structured exceptions into a generic error

Implementation notes

  • Keep strict_http keyword-only
  • Preserve explicit strict_http=True
  • Avoid duplicating strict-mode logic between Mlb and MlbDataAdapter
  • Ensure v1 and v1.1 adapters receive the same resolved default
  • Update docstrings and type annotations with the new default

Acceptance criteria

  • Mlb() raises MlbHttpError for final non-404 4xx responses
  • MlbDataAdapter() uses the documented 1.0 default when constructed directly
  • Explicit strict_http=True behaves identically to the default
  • Endpoint-specific 404 results remain unchanged
  • Final 429 raises after retry exhaustion
  • Existing Session ownership tests continue passing
  • All deterministic HTTP contract tests pass

Suggested branch

feat/v1-strict-http-default

Start from and target:

release/1.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions