Sample
faraday 2.14.3: Construct Faraday requests with base URL path prefixes, method-specific parameters, body serialization, and authentication without triggering silent URL truncations or runtime NoMethodErrors
Verified sample for gem faraday 2.14.3: Construct Faraday requests with base URL path prefixes, method-specific parameters, body serialization, and…
sha256:4a281cc05469474f9f8bddc1c16ee3d6982ff1719c0cc1442b62471b8b9b70eb
This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured.
How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people.
MIT-0
Execution evidence
The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.
- Evidence basis
- Signed contract pass
- Verification receipts
- 2
- Signing keys that built it
- 2
Declared environment
ruby linux x64 ruby ruby rubygems
Verification-run environments
| Environment | Contract | Stages | Run |
|---|---|---|---|
| ruby 3 · linux debian/x64 · docker ed25519:d91480838ac982c9 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · rubygems@1 |
2026-08-17 |
| ruby 3 · linux debian/x64 · docker ed25519:2175b912ea1c23b1 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · rubygems@1 |
2026-08-18 |
Case
HOW- Goal
- Construct Faraday requests with base URL path prefixes, method-specific parameters, body serialization, and authentication without triggering silent URL truncations or runtime NoMethodErrors
- Packages
- Symbols
-
- Faraday.new
- Faraday::Connection#build_url
- Faraday::Connection#get
- Faraday::Connection#post
- Faraday::NestedParamsEncoder
- Faraday::FlatParamsEncoder
- Faraday::Request::Authorization
- Faraday::Request::Json
- Environment
- ruby
- Created
- 2026-08-17T02:36:35Z
Contract
- assert a leading slash in a request path drops the base URL path prefix and resolves from the host root
- assert a relative request path without a leading slash preserves the base URL path prefix
- assert the second argument to conn.get is query parameters and leaves the request body nil
- assert the second argument to conn.post is the request body and leaves the URL query string nil
- assert conn.post with a Hash payload leaves body as a Ruby Hash without request json middleware
- assert request json middleware serializes a Hash body to a JSON string and sets the Content-Type header
- assert conn.basic_auth and conn.authorization raise NoMethodError in Faraday 2
- assert request authorization middleware sets the Authorization header for Bearer and Basic schemes
- assert default NestedParamsEncoder serializes array query parameters with bracket notation
- assert FlatParamsEncoder serializes array query parameters as repeated keys without brackets
- assert Faraday Headers supports case-insensitive and symbol-based key lookup
- assert base URL query parameters merge with connection params and request params
Files
- Gemfile
- Gemfile.lock
- NOTES.md
- csx.json
- src/api_client.rb
- test/contract.rb