kaazing / http2-cache.js

2 stars 11 forks source link

Add method to allow application to check if URL is proxied #39

Open tejaede opened 7 years ago

tejaede commented 7 years ago

Use Case: A snippet of javascript code is used to send requests to 2 URLs: http://proxied.org/query and http://origin-server.org/query

Currently, the application can check if a URL will be proxied in the following way:

_isURLAccelerated: {
    value: function (url) {
        return !!XMLHttpRequest.configuration.getTransportUrl(url);
    }
}

A simpler and more understandable API would be to have a boolean such as one of the following examples:

XMLHttpRequest.isURLProxied(url)
XMLHttpRequest.configuration.isURLProxied(url)
XMLHttpRequest.isURLAccelerated(url)
XMLHttpRequest.configuration.isURLAccelerated(url)
hthetiot commented 7 years ago

See https://github.com/kaazing/http2-cache.js/pull/40#issuecomment-324184983