Class: Persona::Oidc::NetHttpClient

Inherits:
Object
  • Object
show all
Defined in:
lib/persona/oidc/verifier.rb

Overview

Default HTTP client (Net::HTTP) used by Verifier for discovery, JWKS, and the token exchange. Injectable — tests pass a fake responding to the same #get / #post_form contract. Returns the response body on 2xx, nil otherwise.

Instance Method Summary collapse

Instance Method Details

#get(url) ⇒ Object



15
16
17
18
# File 'lib/persona/oidc/verifier.rb', line 15

def get(url)
  uri = URI(url)
  request(uri, Net::HTTP::Get.new(uri))
end

#post_form(url, params) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/persona/oidc/verifier.rb', line 20

def post_form(url, params)
  uri = URI(url)
  req = Net::HTTP::Post.new(uri)
  req['Accept'] = 'application/json'
  req.set_form_data(params)
  request(uri, req)
end