mamantoha / crest

HTTP and REST client for Crystal
https://mamantoha.github.io/crest/
MIT License
235 stars 14 forks source link

Allow to pass a block to the Crest method, this block will then be called with the Response/Resource #77

Closed mamantoha closed 6 years ago

mamantoha commented 6 years ago
Crest::Request.new(:get, "http://example.com") do |request|
  request.http_client.before_request do |http_request|
    something = DoSomething.new(SECRET)
    something.do(http_request)
  end
end
mamantoha commented 6 years ago
Crest::Resource.new("http://example.com") do |resource|
  resource.http_client.before_request do |http_request|
    something = DoSomething.new(SECRET)
    something.do(http_request)
  end
end
mamantoha commented 6 years ago

https://github.com/mamantoha/crest/issues/82