* Strip token from cookies before proxying
Since this functionality requires information placed onto the request by
code-server (req.args) and Express (req.cookies), move the standalone
tests into the integration tests as the proxy can no longer run
correctly on its own without that context.
We could strip the header elsewhere or refactor in some way (pass in a
callback function for the stripping or something) but this seems like
the simplest and safest place at the moment to ensure we catch all uses
of the proxy.
In any case, I think it does lend more confidence to know we are testing
the proxy the way it will be used in practice. The downside is some
additional complexity when setting up tests, but at the moment I do not
think that exchange is overly burdensome.
* Properly stringify the cookie
Cookie values need to be encoded, and they come off the req.cookies
already decoded.
This breaks --proxy-path-passthrough
However, we still need this when that code is disabled as many apps will
issue absolute redirects and expect the proxy to rewrite as appropriate.
e.g. Go's http.Redirect will rewrite relative redirects as absolute!
See https://golang.org/pkg/net/http/#Redirect
This is mostly so we don't have to do any wacky patching but it also
makes it so we don't have to keep checking if the request is a web
socket request every time we add middleware.