https://github.com/fetch/faraday_hal_middleware
Faraday Middleware for JSON HAL requests and responses
https://github.com/fetch/faraday_hal_middleware
Last synced: 12 months ago
JSON representation
Faraday Middleware for JSON HAL requests and responses
- Host: GitHub
- URL: https://github.com/fetch/faraday_hal_middleware
- Owner: fetch
- License: mit
- Created: 2014-12-01T10:20:00.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2024-02-01T15:58:18.000Z (about 2 years ago)
- Last Synced: 2025-03-29T00:51:15.327Z (about 1 year ago)
- Language: Ruby
- Size: 39.1 KB
- Stars: 2
- Watchers: 4
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# FaradayHalMiddleware
[Faraday](https://github.com/lostisland/faraday) Middleware for JSON HAL requests and responses with `application/hal+json` content-type.
[](https://github.com/fetch/faraday_hal_middleware/actions/workflows/test.yml)
## Installation
Add this line to your application's Gemfile:
```ruby
gem 'faraday_hal_middleware'
```
Use version 0.1.1 for Faraday 1.x, and >= 0.2.0 for newer versions of Faraday.
## Usage
Use `faraday_hal_middleware`.
```ruby
require 'faraday_hal_middleware'
connection = Faraday.new 'http://example.com/api' do |conn|
conn.request :hal_json
conn.response :hal_json, content_type: /\bjson$/
conn.adapter Faraday.default_adapter
end
```
This gem is notably used in [Hyperclient](https://github.com/codegram/hyperclient), see [hyperclient#81](https://github.com/codegram/hyperclient/pull/81) for details.
## Contributing
See [CONTRIBUTING](CONTRIBUTING.md).
## Copyright & License
Copyright (c) 2014-2018 Koen Punt and contributors.
MIT License, see [LICENSE.txt](LICENSE.txt) for details.