chulkilee / ex_force

A Salesforce REST API wrapper for Elixir
https://hex.pm/packages/ex_force
MIT License
38 stars 27 forks source link

Encode percentages in SOQL queries #35

Closed gabrielpra1 closed 4 years ago

gabrielpra1 commented 4 years ago

The percentage operator used in the LIKE SOQL operator must be encoded, otherwise the following error is thrown:

Illegal Request.
You have sent us an Illegal URL or an improperly formatted request.
sourcelevel-bot[bot] commented 4 years ago

Hello, @gabrielpra1! This is your first Pull Request that will be reviewed by SourceLevel, an automatic Code Review service. It will leave comments on this diff with potential issues and style violations found in the code as you push new commits. You can also see all the issues found on this Pull Request on its review page. Please check our documentation for more information.

coveralls commented 4 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling 7aa3a893b2cb53ae6c7081e6d0e8f8d0b290fb56 on gabrielpra1:fix-invalid-request into 99426cfc5b7e47a97c4976804b423444cb7b1f88 on chulkilee:master.

coveralls commented 4 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling 7aa3a893b2cb53ae6c7081e6d0e8f8d0b290fb56 on gabrielpra1:fix-invalid-request into 99426cfc5b7e47a97c4976804b423444cb7b1f88 on chulkilee:master.

chulkilee commented 4 years ago

Thanks for the catch! I believe this is a tesla bug - reported at https://github.com/teamon/tesla/issues/336

Could you test if tesla + hackeny doe not have this problem?

gabrielpra1 commented 4 years ago

You are right! Just changing the adapter to hackney worked.

Do you think we should leave this as is, since the adapter can be configured by the application that is using the library?

Or perhaps it would be better to use hackney as the default adapter for the library, since httpc is not recommended by Tesla anyway: https://hexdocs.pm/tesla/readme.html#installation

The default adapter is erlang's built-in httpc, but it is not recommended to use it in production environment as it does not validate SSL certificates among other issues.

chulkilee commented 4 years ago

I don't want to make this library to add dependency on specific http library - that's why I picked Tesla.

Instead, we may note the known limitation somewhere.

chulkilee commented 4 years ago

Closing it - for now documented at wiki page - https://github.com/chulkilee/ex_force/wiki/Choosing-a-Tesla-Adapter


Thanks a lot for this PR! :heart: :heart: