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

Core components of Bluemix Mobile Services Android SDK
Apache License 2.0
6 stars 11 forks source link

BaseRequest shouldn't remove trailing slash from URLs #31

Closed dannycao closed 7 years ago

dannycao commented 7 years ago

@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?

AnthonyOliveri commented 7 years ago

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

Aerex commented 7 years ago

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

dgonz7 commented 7 years ago

Fixed this in 2.2.5, forgot to close this.