ibm-bluemix-mobile-services/bms-clientsdk-android-core

BaseRequest shouldn't remove trailing slash from URLs

Closed this issue · 3 comments

@dgonz7
In Android core package BaseRequest class, trailing slash / are removed from the URL. This doesn't seem right because there are URLs that have/need the / and I'm not sure why it's necessary to remove it. For example, this URL ('https://www.reddit.com/r/Awww/') needs the trailing slash. Doing a request to 'https://www.reddit.com/r/Awww' returns a 301 Moved Permanently, then another request has to be made to the one with trailing slash. This results in two requests when there really should've been 1. This creates a problem for Mobile Analytics because we then see this as two separate requests instead of 1.

https://github.com/ibm-bluemix-mobile-services/bms-clientsdk-android-core/blob/master/lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/core/internal/BaseRequest.java#L130

In Swift core, I don't see code that removes trailing slash:
https://github.com/ibm-bluemix-mobile-services/bms-clientsdk-swift-core/blob/master/Source/Network%20Requests/BaseRequest.swift

@AnthonyOliveri @Aerex : can you verify that Swift and Cordova are not removing trailing slashes from URLs?

@dannycao The Swift BMSCore SDK does not remove trailing slashes.

Aerex commented

@dannycao Cordova depends on the native implementation so if it is not removed in Android and Swift it is not removed in Cordova.

Fixed this in 2.2.5, forgot to close this.