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

When I include a “+” in the url query parameter in the salesforce.apex mothod, it seems to be replaced by a space on the server. #58

Closed
hmuronaka opened this issue Jan 19, 2018 · 6 comments
Assignees

Comments

@hmuronaka
Copy link
Contributor

When I include a “+” in the url query parameter in the salesforce.apex(:method:.get, path,path, queryParameters:) mothod, it seems to be replaced by a space on the server.

When SwiftlySalesforce was in version Alamofire, I could use the “+” character was replaced with the correct value of “%2B” without any problems. Now it is replaced with ” “.

What is the correct way to build my query parameter that includes the “+” character?

https://stackoverflow.com/questions/43052657/encode-using-urlcomponents-in-swift

@mike4aday mike4aday self-assigned this Jan 19, 2018
@mike4aday
Copy link
Owner

Thanks @hmuronaka, I'll look into this. To help me reproduce, can you post the code you are using to build the URL.

@hmuronaka
Copy link
Contributor Author

hmuronaka commented Jan 22, 2018

Please try below queryParameters for reproduce.

salesforce.apex(method: .get, path:path, queryParameters:["date": "2018-01-18T00:55:32.000+0000"])
`


Please refer my pullrequest #59 for update.

@mike4aday
Copy link
Owner

Thanks @hmuronaka - resolved with version 6.0.3

@mike4aday
Copy link
Owner

@hmuronaka FYI you can use the DateFormatter extension in Swiftly Salesforce to format dates for Salesforce:

	public static let salesforceDateTimeFormatter: DateFormatter = {
		let formatter = DateFormatter()
		formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZZZ"
		return formatter
	}()

@hmuronaka
Copy link
Contributor Author

["date": "2018-01-18T00:55:32.000+0000"] is one of example.
I think escaping is necessary also in cases like ["keyword": "abc + def"] and so on...

Anyway thank you your information and for merging my pullrequest!

@mike4aday
Copy link
Owner

@hmuronaka indeed. I just meant you could, instead of writing out the date as a string, use:
DateFormatter.salesforceDateTimeFormatter.string(from: myDateValue)

Thank you for the pull request.

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

No branches or pull requests

2 participants