# Class BSV::Overlay::HTTPSLookupFacilitator <a id="class-BSV-Overlay-HTTPSLookupFacilitator"></a>

**Inherits:** `BSV::Overlay::LookupFacilitator`

Default HTTPS-based lookup facilitator using Net::HTTP.

POSTs to +{url}/lookup+ with a JSON body and the +X-Aggregation: yes+ header,
as required by the BSV Overlay Services protocol.

HTTPS is enforced by default; pass +allow_http: true+ to permit plain HTTP
(useful for local development and testing).

An injectable `http_client` may be supplied for testing. It must respond to
+#request(uri, net_http_request)+ and return an object with <code>#code</code>
and <code>#body</code>.

## Public Instance Methods
### `initialize(allow_http: = false, http_client: = nil)` <a id="method-i-initialize"></a> <a id="initialize-instance_method"></a>
- **@param** `allow_http` [Boolean] permit non-HTTPS URLs (default: false)
- **@param** `http_client` [#request, nil] injectable HTTP client for testing
- **@return** [HTTPSLookupFacilitator] a new instance of HTTPSLookupFacilitator

### `lookup(url, question, timeout: = 5)` <a id="method-i-lookup"></a> <a id="lookup-instance_method"></a>
Perform an HTTPS POST to +{url}/lookup+ and return the parsed answer.
- **@param** `url` [String] base URL of the Overlay Services host
- **@param** `question` [LookupQuestion] the question to send
- **@param** `timeout` [Integer] request timeout in seconds (default: 5)
- **@raise** [ArgumentError] if the URL is not HTTPS and +allow_http+ is false
- **@raise** [RuntimeError] if the server returns a non-2xx status
- **@return** [LookupAnswer]
