Remove trailing slash from origin header if no port is specified (#22290)

Summary:
Fixes #16304

The standard format for origin HTTP headers does not allow a trailing slash. In order to not get warnings when connecting a websocket, I removed the trailing slash when generating the default origin HTTP header for the websocket connect request.

Release Notes:
----------
[Android] [Fixed] - Fixed default origin header for websocket connections to match the standard format (https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Origin) in WebSocketModule
Pull Request resolved: https://github.com/facebook/react-native/pull/22290

Differential Revision: D13374345

Pulled By: cpojer

fbshipit-source-id: 1173241f2b6912fd6df5e196053a950bb42ff01b
This commit is contained in:
Lea Bärtschi 2018-12-06 21:16:53 -08:00 committed by Facebook Github Bot
parent de6cdc442d
commit cbe7d41f3f
1 changed files with 1 additions and 1 deletions

View File

@ -357,7 +357,7 @@ public final class WebSocketModule extends ReactContextBaseJavaModule {
requestURI.getHost(),
requestURI.getPort());
} else {
defaultOrigin = String.format("%s://%s/", scheme, requestURI.getHost());
defaultOrigin = String.format("%s://%s", scheme, requestURI.getHost());
}
return defaultOrigin;