diff options
| author | mokha <mokha@cisco.com> | 2018-05-14 15:16:56 -0600 |
|---|---|---|
| committer | mokha <mokha@cisco.com> | 2018-05-14 15:16:56 -0600 |
| commit | a417b0f2a34582618c93740fd74ca1c620a39e54 (patch) | |
| tree | 04b4922bf963a483a860b81052fbbdc3b450629a /lib/net/hippie/client.rb | |
| parent | 64f0138cff42932a4374c178d1c23d0e7de97fcc (diff) | |
attempt to map body using content type header.
Diffstat (limited to 'lib/net/hippie/client.rb')
| -rw-r--r-- | lib/net/hippie/client.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/net/hippie/client.rb b/lib/net/hippie/client.rb index b32c0f8..53f80d7 100644 --- a/lib/net/hippie/client.rb +++ b/lib/net/hippie/client.rb @@ -20,7 +20,7 @@ module Net @certificate = certificate @default_headers = headers @key = key - @mapper = JsonMapper.new + @mapper = ContentTypeMapper.new @passphrase = passphrase @verify_mode = verify_mode end @@ -70,8 +70,9 @@ module Net end def request_for(type, uri, headers: {}, body: {}) - type.new(uri, default_headers.merge(headers)).tap do |x| - x.body = mapper.map_from(body) unless body.empty? + final_headers = default_headers.merge(headers) + type.new(uri, final_headers).tap do |x| + x.body = mapper.map_from(final_headers, body) unless body.empty? end end |
