In order to setup a HTTP-based API successfully, it is necessary to check request and response.
Postman is a great tool to check the response, how about the request ?
It can be trouble that if we cannot access a 3rd party system's request log while we have to send request to them . How can we verify the request we made is valid ? If the request will be altered by some middleware we may not able to touch ?
Here is one of the solution , make a mock server to capture the final request to the endpoint.
In past , it may takes time to setup a mock server , now , it becomes super easy.
The great tool here is beeceptor !!! No registration needed , no installation needed.
Just need one browser tab ~
Steps as simple as below :
- Create an endpoint at https://beeceptor.com/ and leave this browser tab open.
The endpoint will be like :
https://{your_input_name}.free.beeceptor.com
- Change the endpoint used in code to the endpoint you just created .
- Execute the request in code from your IDE or other place , just execute your callout code.
- Refresh your https://beeceptor.com/ browser tab .
- Now you can check the request and header you just send, and you may create any response in the mock server .
Reference : https://help.salesforce.com/s/articleView?id=000384720&type=1
Thanks for reading.
No comments:
Post a Comment