Skip to content

Commit 33b5466

Browse files
Lea Bärtschigrabbou
Lea Bärtschi
authored andcommitted
Remove trailing slash from origin header if no port is specified (facebook#22290)
Summary: Fixes facebook#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: facebook#22290 Differential Revision: D13374345 Pulled By: cpojer fbshipit-source-id: 1173241f2b6912fd6df5e196053a950bb42ff01b
1 parent f73bfc2 commit 33b5466

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ReactAndroid/src/main/java/com/facebook/react/modules/websocket/WebSocketModule.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ private static String getDefaultOrigin(String uri) {
352352
requestURI.getHost(),
353353
requestURI.getPort());
354354
} else {
355-
defaultOrigin = String.format("%s://%s/", scheme, requestURI.getHost());
355+
defaultOrigin = String.format("%s://%s", scheme, requestURI.getHost());
356356
}
357357

358358
return defaultOrigin;

0 commit comments

Comments
 (0)