From 33b5466c62509ef2d624a140d09a41e0d7c3821d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lea=20B=C3=A4rtschi?= Date: Thu, 6 Dec 2018 21:16:53 -0800 Subject: [PATCH] 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 --- .../com/facebook/react/modules/websocket/WebSocketModule.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/websocket/WebSocketModule.java b/ReactAndroid/src/main/java/com/facebook/react/modules/websocket/WebSocketModule.java index 33d8644eeabff7..c9bbcb73457115 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/websocket/WebSocketModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/websocket/WebSocketModule.java @@ -352,7 +352,7 @@ private static String getDefaultOrigin(String uri) { requestURI.getHost(), requestURI.getPort()); } else { - defaultOrigin = String.format("%s://%s/", scheme, requestURI.getHost()); + defaultOrigin = String.format("%s://%s", scheme, requestURI.getHost()); } return defaultOrigin;