Closed luqven closed 3 years ago
Initially, I felt that users should stick to using the instance methods if they want to build proxy URLs
I second this ☝🏼 . sanitize
option can and IMO should be removed.
As for proxies, for one-step URLs we can treat proxies as an opts
parameter. Something like
const url = "https://foo.bar.net"
const opts = { proxy: "https://bar.baz.net/img.jpg" }
const params = {fit: "crop"}
_buildOneStepURL({ url, params, opts }) {
// somewhere inside _buildOneStepURL
if (options.proxy) {
path = client._sanitizePath(options.proxy);
}
@luqven Yeah that sounds like a plausible solution. Since this will probably take a few beta releases to get right, I'd say feel free to experiment with the interface until all the wrinkles get ironed out 👍
Updated this PR to rename the static method to _buildURL
, rename opts
to options
, and rename the test suite to match.
Closing in favor of #294
This PR creates the
_buildURL
static method on the ImgixClient. This methods allows us to use a 1-step, or full, URL to generate imgix formatted urls.Future work
Proxy URL tests are needed here. They're not being handled as of yet.