Skip to content

No exported setter for the package-level ProblemConfig #15

Description

@rluders

GetProblemTypeURL reads from a package-level defaultProblemConfig (built once via NewProblemConfig()), but there's no exported way to replace it — only DefaultProblemConfig() (read-only copy) and the per-call ParseOptions.Problems override on ParseRequest.

Consumers that want a custom BaseURL (to emit real RFC 9457 type URIs instead of bare words like "unauthorized") or additional ErrorTypePaths globally have no way to configure this once at startup — they'd have to pass ParseOptions.Problems on every single ParseRequest call, and there's no equivalent hook at all for the direct helpers (NewProblemDetails, ProblemBadRequest, etc.), which always resolve via the package-level default.

Found while auditing usage across a ~150k LOC service (GolgiMed): 60+ call sites construct ProblemDetails with a bare-word type ("unauthorized", "forbidden", ...) instead of a proper URI, because there's no way to register a base URL once and have every helper pick it up.

Requested: SetProblemConfig(cfg ProblemConfig) (mirroring SetValidator/ClearValidator's pattern) so an app can configure BaseURL + ErrorTypePaths once at composition root.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions