Skip to content

Support per-request query/timeout/options and default_options; update README and add specs - #3

Merged
nemuba merged 1 commit into
mainfrom
codex/planejar-melhoria-ou-nova-feature
Sep 12, 2026
Merged

nemuba merged 1 commit into
mainfrom
codex/planejar-melhoria-ou-nova-feature

Conversation

@nemuba

@nemuba nemuba commented Sep 12, 2026

Copy link
Copy Markdown
Owner

Motivation

  • Provide per-request query parameters and timeouts and allow configuring default HTTParty options for clients.
  • Make it possible to pass other HTTParty request options and control precedence between defaults, per-request options:, and explicit arguments.

Description

  • Added default_options class setter and extended get, post, put, and delete signatures to accept query:, timeout:, and options: (and body: for delete).
  • Reworked request to accept the new keywords and introduced build_request_options to merge @default_options, per-request options, and explicit arguments with the intended precedence and without mutating input hashes.
  • Updated build_headers logic and header merging so headers from defaults, generic options[:headers], and explicit headers: are merged with explicit request headers taking precedence.
  • Updated README.md with usage examples for query:, timeout:, options:, default_options, and the modified method signatures.
  • Added spec/service_client_options_spec.rb with RSpec tests that validate option merging, header merging, immutability of option hashes, omission of unset optional values, body/query passthrough, and ParamsRequired behavior.

Testing

  • Added an RSpec file spec/service_client_options_spec.rb that exercises merging precedence, header merging, immutability, omission of unset values, and parameter passthrough.
  • Ran the RSpec suite covering the new specs and the new tests passed.
  • Verified that HTTParty is called with the expected merged option hashes in the tests.

Codex Task

@nemuba
nemuba merged commit 49d3bf8 into main Sep 12, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant