JSON.LD.DocumentLoader.RemoteDocument (JSON-LD.ex v1.0.0)
View SourceImplementation of the JSON-LD 1.1 Remote Document and Context Retrieval specification.
This module provides both:
- A struct representing remote documents as specified in https://www.w3.org/TR/json-ld11-api/#remotedocument
- The core implementation of remote document loading according to
https://www.w3.org/TR/json-ld11-api/#remote-document-and-context-retrieval so that
custom
JSON.LD.DocumentLoader
implementations can reuse this by callingload/3
or implementing their own loading logic.
Custom HTTP clients
The default Tesla-based HTTP client is JSON.LD.DocumentLoader.DefaultClient
.
If you need a custom HTTP client with custom middleware, you can create your own module
that implements a client/3
function:
defmodule MyCustomClient do
use Tesla
def client(headers, url, options) do
[
{Tesla.Middleware.Headers, headers},
# your custom middleware
]
|> Tesla.client()
end
end
and configure it as:
config :json_ld, :http_client, MyCustomClient
Summary
Functions
Loads a remote document from the given URL.
Types
Functions
@spec load(String.t(), JSON.LD.Options.convertible(), module()) :: {:ok, t()} | {:error, any()}
Loads a remote document from the given URL.
According to https://www.w3.org/TR/json-ld11-api/#remote-document-and-context-retrieval