0

I created one class to make http callout to ftp server.I am using Http mock for test class.Sometimes ftp folders are created with space and it is required to encode the file and folder name in ftp url. 1. In first screenshot, i m using http request without encode 2.In 2nd screenshot I have encoded file name and folder name

I ran same test class for both, in first scenario http send method is executed.In second scenario http send method is not executing.

Can someone provide correction and explanation for it ?

enter image description here

enter image description here

1

Execution of req.setEndpoint in test-class throws some exception. That is why after that is goes to catch block and callout is not sending at all. Remove try-catch block and you will able to check thrown exception and will know exactly what is a problem.

In addition, I don't see what are you doing in catch block, but catching general Exception is a bad practice. Catch exception only if you know what you have to do it with it.

Here is a nice Pokemon Catch sfdcfox's answer

  • Hi Oleksandr, ts weird that its working in actual scenario (trying from UI). URL encode should not break the call. – Abhi Oct 31 '18 at 17:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.