mirror of
https://github.com/d0zingcat/cors-anywhere.git
synced 2026-05-13 15:09:25 +00:00
Remove getHandler
It is not supported, and its current form was not documented. If you need to proxy a request without listening on a port, just dispatch a 'request' event on the return value of createServer().
This commit is contained in:
@@ -207,7 +207,7 @@ function parseURL(req_url) {
|
||||
}
|
||||
|
||||
// Request handler factory
|
||||
var getHandler = exports.getHandler = function(options, proxy) {
|
||||
function getHandler(options, proxy) {
|
||||
var corsAnywhere = {
|
||||
getProxyForUrl: getProxyForUrl, // Function that specifies the proxy to use
|
||||
maxRedirects: 5, // Maximum number of redirects to be followed.
|
||||
@@ -217,13 +217,13 @@ var getHandler = exports.getHandler = function(options, proxy) {
|
||||
removeHeaders: [], // Strip these request headers.
|
||||
setHeaders: {}, // Set these request headers.
|
||||
};
|
||||
if (options) {
|
||||
Object.keys(corsAnywhere).forEach(function(option) {
|
||||
if (Object.prototype.hasOwnProperty.call(options, option)) {
|
||||
corsAnywhere[option] = options[option];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Object.keys(corsAnywhere).forEach(function(option) {
|
||||
if (Object.prototype.hasOwnProperty.call(options, option)) {
|
||||
corsAnywhere[option] = options[option];
|
||||
}
|
||||
});
|
||||
|
||||
// Convert corsAnywhere.requireHeader to an array of lowercase header names, or null.
|
||||
if (corsAnywhere.requireHeader) {
|
||||
if (typeof corsAnywhere.requireHeader === 'string') {
|
||||
@@ -321,7 +321,7 @@ var getHandler = exports.getHandler = function(options, proxy) {
|
||||
|
||||
proxyRequest(req, res, proxy);
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
// Create server with default and given values
|
||||
// Creator still needs to call .listen()
|
||||
|
||||
Reference in New Issue
Block a user