diff options
| author | mo <mo@mokhan.ca> | 2018-05-07 15:23:33 -0600 |
|---|---|---|
| committer | mo <mo@mokhan.ca> | 2018-05-07 15:23:33 -0600 |
| commit | 6bb6fdb072c576a4d80e0e1869049ea122738695 (patch) | |
| tree | d2f6b92afbc206a5c84e5fe807cf7e25dc9ad1eb /README.md | |
| parent | 54ab2db6336b1116927200d6afc25e2af35282c8 (diff) | |
do not accept default headers in ctor.v0.1.2
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 15 |
1 files changed, 12 insertions, 3 deletions
@@ -26,12 +26,21 @@ require 'net/hippie' Net::Hippie.logger = Rails.logger -client = Net::Hippie::Client.new(headers: { +client = Net::Hippie::Client.new + +headers = { 'Accept' => 'application/vnd.haveibeenpwned.v2+json' -}) +} -response = client.get(URI.parse('https://haveibeenpwned.com/api/breaches')) +uri = URI.parse('https://haveibeenpwned.com/api/breaches') +response = client.get(uri, headers: headers) +puts JSON.parse(response.body) +``` +```ruby +client = Net::Hippie::Client.new +body = { user: { name: 'hippie' } } +response = client.post(URI.parse('https://example.com'), body: body) puts JSON.parse(response.body) ``` |
