Repository navigation
Fix swapped X-Afterpay-SDK request header name and value - #303
Open
Avicennasis wants to merge 1 commit into
Open
Avicennasis wants to merge 1 commit into
Avicennasis wants to merge 1 commit into
Conversation
HttpsURLConnection.setRequestProperty takes (key, value), but ApiV3 and AfterpayCashAppApi passed the SDK version string as the header name and "X-Afterpay-SDK" as its value. Swap the arguments so requests carry X-Afterpay-SDK: <version>-android, matching the iOS SDK. Signed-off-by: Léon Avic Simmons <Avicennasis@gmail.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of Changes
ApiV3.configure()(afterpay/src/main/kotlin/com/afterpay/android/internal/ApiV3.kt) andAfterpayCashAppApi.configure()(afterpay/src/main/kotlin/com/afterpay/android/cashapp/AfterpayCashAppApi.kt) callconnection.setRequestProperty("${BuildConfig.AfterpayLibraryVersion}-android", "X-Afterpay-SDK").setRequestPropertytakes(key, value), so every V3 and Cash App Pay request sends a header named after the SDK version (<version>-android: X-Afterpay-SDK) instead ofX-Afterpay-SDK: <version>-android.X-Afterpay-SDKwith the SDK version as the value (Sources/Afterpay/ApiV3.swift).Items of Note
This is a small behaviour change, not a comment fix: requests will now carry a real
X-Afterpay-SDKheader and stop sending the version-named one. No test was added. The existingAfterpayCashAppApiTeststubssetRequestProperty(any(), any()). I'm happy to add an assertion on the header if you'd like one.The change is limited to the two
setRequestPropertylines.