Skip to content

Commit cbe7d41

Browse files
Lea Bärtschifacebook-github-bot
Lea Bärtschi
authored andcommitted
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: #22290 Differential Revision: D13374345 Pulled By: cpojer fbshipit-source-id: 1173241f2b6912fd6df5e196053a950bb42ff01b
1 parent de6cdc4 commit cbe7d41

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ private static String getDefaultOrigin(String uri) {
357357
requestURI.getHost(),
358358
requestURI.getPort());
359359
} else {
360-
defaultOrigin = String.format("%s://%s/", scheme, requestURI.getHost());
360+
defaultOrigin = String.format("%s://%s", scheme, requestURI.getHost());
361361
}
362362

363363
return defaultOrigin;

0 commit comments

Comments
 (0)