Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: added url path encoding #376

Merged
merged 4 commits into from Aug 31, 2023
Merged

fix: added url path encoding #376

merged 4 commits into from Aug 31, 2023

Conversation

Shahroz16
Copy link
Contributor

closes: customerio/customerio-reactnative#191

Complete each step to get your pull request merged in. Learn more about the workflow this project uses.

  • Assign members of your team to review the pull request.
  • Wait for pull request status checks to complete. If there are problems, fix them until you see that all status checks are passing.
  • Wait until the pull request has been reviewed and approved by a teammate
  • After code reviews are approved and you determine this PR is ready to merge, select Squash and Merge button on this screen, leave the title and description to the default values, then merge the PR.

@github-actions
Copy link

github-actions bot commented Aug 30, 2023

Pull request title looks good 👍!

If this pull request gets merged, it will cause a new release of the software. Example: If this project's latest release version is 1.0.0. If this pull request gets merged in, the next release of this project will be 1.0.1. This pull request is not a breaking change.

All merged pull requests will eventually get deployed. But some types of pull requests will trigger a deployment (such as features and bug fixes) while some pull requests will wait to get deployed until a later time.

This project uses a special format for pull requests titles. Expand this section to learn more (expand by clicking the ᐅ symbol on the left side of this sentence)...

This project uses a special format for pull requests titles. Don't worry, it's easy!

This pull request title should be in this format:

<type>: short description of change being made

If your pull request introduces breaking changes to the code, use this format:

<type>!: short description of breaking change

where <type> is one of the following:

  • feat: - A feature is being added or modified by this pull request. Use this if you made any changes to any of the features of the project.

  • fix: - A bug is being fixed by this pull request. Use this if you made any fixes to bugs in the project.

  • docs: - This pull request is making documentation changes, only.

  • refactor: - A change was made that doesn't fix a bug or add a feature.

  • test: - Adds missing tests or fixes broken tests.

  • style: - Changes that do not effect the code (whitespace, linting, formatting, semi-colons, etc)

  • perf: - Changes improve performance of the code.

  • build: - Changes to the build system (maven, npm, gulp, etc)

  • ci: - Changes to the CI build system (Travis, GitHub Actions, Circle, etc)

  • chore: - Other changes to project that don't modify source code or test files.

  • revert: - Reverts a previous commit that was made.

Examples:

feat: edit profile photo
refactor!: remove deprecated v1 endpoints
build: update npm dependencies
style: run formatter 

Need more examples? Want to learn more about this format? Check out the official docs.

Note: If your pull request does multiple things such as adding a feature and makes changes to the CI server and fixes some bugs then you might want to consider splitting this pull request up into multiple smaller pull requests.

@github-actions
Copy link

github-actions bot commented Aug 30, 2023

Sample app builds 📱

Below you will find the list of the latest versions of the sample apps. It's recommended to always download the latest builds of the sample apps to accurately test the pull request.


  • APN-UIKit: shahroz/fix-path-encoding (1693516636)
  • CocoaPods-FCM: shahroz/fix-path-encoding (1693516695)

@Shahroz16 Shahroz16 requested a review from a team August 31, 2023 11:07
@@ -44,4 +44,29 @@ class HttpEndpointTest: UnitTest {

XCTAssertEqual(actual, expected)
}

func test_getUrlString_givenRandomPathNeedsEncoding_expectEncodedPath() {
let identifierWithSpecialChar = String.randomStringWithSpecialCharacters()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer if we hard-coded test data instead of randomly generate it. Maybe the randomly generated string gives us a char with no special chars, for example.

The other test function is great in that it includes a special character that we have identified causes issues for customers. I like the idea of hard-coding test strings that we know could cause an issue.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, but random values does extend range for testing more characters. We can perhaps update randomStringWithSpecialCharacters to must include special character every time.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if we hard-code abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~:/?#[]@!$&'()*+,;=% as the identifier?

I think that would do the same thing as randomStringWithSpecialCharacters if not be more valuable because every time we run the test suite, we are checking all special characters intead of some.

Tests/Common/Service/HttpEndpointTest.swift Outdated Show resolved Hide resolved
@@ -31,6 +31,11 @@ public extension String {
String((0 ..< length).map { _ in abcLetters.randomElement()! })
}

static func randomStringWithSpecialCharacters(length: Int = 20) -> String {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we do end up using this function, move it into Tests/Shared since it's a function used only for tests.

@Shahroz16 Shahroz16 merged commit fbfa384 into main Aug 31, 2023
9 checks passed
@Shahroz16 Shahroz16 deleted the shahroz/fix-path-encoding branch August 31, 2023 21:38
github-actions bot pushed a commit that referenced this pull request Aug 31, 2023
## [2.8.1](2.8.0...2.8.1) (2023-08-31)

### Bug Fixes

* added url path encoding ([#376](#376)) ([fbfa384](fbfa384))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Errors when trying to identify user on iOS
3 participants