Private method handle
Response handler
Parameters:
req must be an Object.
(HTTP(S) request Object)
res must be an Object.
(HTTP(S) response Object)
arg can be of any type.
(Proxy response)
xhr must be an Object.
(XmlHttpRequest)
Returns an Undefined
(undefined)
Something went wrong
Determining how long rep is valid
Removing from LRU when invalid
Setting headers
Determining if a 304 response is valid based on Etag only (no timestamp is kept)
Fixing root path of response
Private method headers
Capitalizes HTTP headers
Parameters:
Returns an Object
(Reshaped response headers)
Private method wrapper
Wraps the proxy request
Parameters:
req must be an Object.
(HTTP(S) request Object)
res must be an Object.
(HTTP(S) response Object)
Returns an Undefined
(undefined)
Facade to handle()
Streaming formats that do not need to be rewritten
Stripping existing authorization header because it's not relevant for the remote system
Identifying proxy behavior
Streaming response to Client
Acting as a RESTful proxy
Removing support for compression so the response can be rewritten (if textual)
Setting route
Method proxy
Proxies a URL to a route
Parameters:
route must be a String.
(Route to proxy)
origin must be a String.
(Host to proxy (e.g. http://hostname))
host must be a String.
([Optional] Hostname this route is for (default is all))
stream must be a Boolean.
([Optional] Stream response to client (default is false))
Returns an Object
(TurtleIO instance)