Enhanced http client for ruby. Packed with retry mechanism, circuit breaker, and datadog monitoring.
gem install pigeon-http
require 'pigeon-http'
client = Pigeon::Client.new('http_request')
response = client.get('https://google.com')
Pigeon comes with configurable options related to http request.
options: {
request_timeout: 60, # default value
request_open_timeout: 60, # default value
ssl_verify: false, # default value
}
client = Pigeon::Client.new('http_request', options: options)
response = client.get('https://google.com')
Note: http_request
is a request identifier. It will be used as circuit breaker and datadog monitoring name.
require 'pigeon-http'
payload: {
foo: "bar"
}
client = Pigeon::Client.new('http_request')
response = client.post('https://google.com', body: payload)
require 'pigeon-http'
payload: {
foo: "bar"
}
client = Pigeon::Client.new('http_request')
response = client.post('https://google.com', query: payload)
require 'pigeon-http'
payload: {
foo: "bar"
}
client = Pigeon::Client.new('http_request')
response = client.post('https://google.com', form: payload)
Query params only applicable for GET request.
require 'pigeon-http'
param: {
foo: "bar"
}
client = Pigeon::Client.new('http_request')
response = client.get('https://google.com', query: param)
By default, the retry mechanism is disable. We can enable and configure it when initialize the pigeon.
options: {
retryable: false, # default value
retry_threshold: 3 # default value
}
client = Pigeon::Client.new('http_request', options: options)
response = client.get('https://google.com')
The retry mechanism using backoff time using following calculation:
4**n
Which n
is retry counter.