diff --git a/packages/react-server/core/ClientRequest.js b/packages/react-server/core/ClientRequest.js index f0929a29c..8d03be5ee 100644 --- a/packages/react-server/core/ClientRequest.js +++ b/packages/react-server/core/ClientRequest.js @@ -63,6 +63,28 @@ class ClientRequest { return decode(this._url.substring(indexOfQuestion + 1)); } + getHostname() { + var hostname = null; + if (typeof window.location.hostname === "string") { + hostname = window.location.hostname; + } + + return hostname; + } + + getProtocol() { + var proto = null; + if (typeof window.location.protocol === "string") { + proto = window.location.protocol.replace(/:/g,''); + } + + return proto; + } + + getSecure() { + return ('https' === this.getProtocol()); + } + getRouteParams() { return this._route.params; } diff --git a/packages/react-server/core/ExpressServerRequest.js b/packages/react-server/core/ExpressServerRequest.js index 1e9a10f89..3fb8640ac 100644 --- a/packages/react-server/core/ExpressServerRequest.js +++ b/packages/react-server/core/ExpressServerRequest.js @@ -20,6 +20,18 @@ class ExpressServerRequest { return this._wrappedRequest.query; } + getHostname() { + return this._wrappedRequest.hostname; + } + + getProtocol() { + return this._wrappedRequest.protocol; + } + + getSecure() { + return this._wrappedRequest.secure; + } + getRouteParams() { return this._route.params; }