Skip to content

Preserve caller-owned JSON parser options - #1689

Merged
olleolleolle merged 1 commit into
lostisland:mainfrom
OskarEichler:codex/preserve-json-parser-options
Aug 27, 2026
Merged

olleolleolle merged 1 commit into
lostisland:mainfrom
OskarEichler:codex/preserve-json-parser-options

Conversation

@OskarEichler

Copy link
Copy Markdown
Contributor

Summary

Duplicate parser options before extracting the decoder.

Reproduction and verification

Construct JSON response middleware twice from the same parser_options hash containing :decoder: baseline deletes the decoder and the second instance falls back to JSON. A frozen options hash raises FrozenError. Both work after the fix.

  • Individual patch: 9 focused Faraday checks passed (json); all 639 existing RSpec examples pass; changed-file RuboCop and Ruby syntax pass.
  • Combined installed-release-based branch: 639 existing examples, 1,124 focused checks, full RuboCop (75 files), YARD checks and gem packaging pass.
  • External faraday-net_http adapter suite: 386 existing examples, zero failures with the combined fixes.
  • Ruby 4.0.6 through rbenv. No production or live external HTTP operations.

Limitations

No test/spec files were added or changed because the originating repository explicitly forbids this. Reproductions ran outside the repository. This differs from Faraday's requested regression-test contribution convention and is disclosed for maintainer review. Other Ruby versions/platforms were not run locally. This PR includes only the focused source change; the other fixes and the consumer's separately verified merged JSON decoder patch #1687 are not added here.

Breaking-change notes

No API changes. Initialization stops mutating caller options and snapshots their top-level values.

@olleolleolle olleolleolle left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change looks good.

The note about the repo not accepting tests read a little strong.

@olleolleolle
olleolleolle merged commit 9458f04 into lostisland:main Aug 27, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants