TestProject Forum

Debugging and testing addons

Is there a simple way to test an addon with test project?

I’m having issues with the HTTP PATCH addon (it doesn’t appear to be sending all of the headers correctly), and I see that the addon is in github, but I wasn’t sure how to debug it while using the agent and see why it’s not working for me.

Hello @g.arch,

You can download the addon from GitHub to your local machine, open it with your IDE, go to the actions class, find the PATCH action, put your body and authorization parameters and then you can run the addon in debug mode:

Put your headers under pathActions.headers separated by comma
For example: patchAction.headers = "Authorization=YOUR_API_TOKEN";

You can put breakpoints in the code to easily debug it.

1 Like

Thanks for the response…another QQ. I have downloaded Java16. Is there a specific Java version I should be using? I’ve been getting some “major version 60” conflicts when trying to use the TestProject SDK jar.

Got this working in the end using Eclipse (3rd IDE I had to try). Dropped down to Java11 and dropped in the SDK to my environment variables.

Turns out the PATCH request (and all requests that aren’t passing in the format to the <method>Action) are having the “Content-Type” being overwritten by the media-type in the entity variant in the code. My API call has extra information after the application/json in the Content-Type which the API is using. Once this was stripped out by the code, my call failed. I would have put a pull request out for it, but did not want to change code that would mess with every request of the API addon. Plus adding to the “format” does fix the issue, but would probably be a better solution to fix the media-type overriding what is being passed in the Content-Type.

This post was flagged by the community and is temporarily hidden.