tesla v0.9.0 Tesla.Middleware.BaseUrl View Source

Set base URL for all requests.

The base URL will be prepended to request path/url only if it does not include http(s).

Example usage

defmodule MyClient do
  use Tesla

  plug Tesla.Middleware.BaseUrl, "https://api.github.com"
end

MyClient.get("/path") # equals to GET https://api.github.com/path
MyClient.get("http://example.com/path") # equals to GET http://example.com/path

Link to this section Summary

Link to this section Functions

Callback implementation for Tesla.Middleware.call/3.