TestProject Forum

Failed to send the request due to an error when trying to POST

Hi,

I’m trying to do a POST in an http (not https) url and I’m getting this error:

Message
java.util.concurrent.ExecutionException: io.testproject.java.sdk.v2.exceptions.FailureException: Failed to send the request due to an error
Caused by io.testproject.java.sdk.v2.exceptions.FailureException: Failed to send the request due to an error

I cannot provide the exact URL because it is internal but it looks like this:

http://mycompany.cloudapp.azure.com/asa/api/login
{
“UserName”: “domain\myUsername”,
“Password”: “myPassword”,
“BackendCode”: “myBackendCode”
}

In POSTMAN it works fine, so it is not proxy or environment related.

I realized this error doesn’t happen when the URL is HTTPS but I’m not sure if it is that the issue. I also read the documentation https://github.com/testproject-io/addons/tree/master/restful-api-client and I tried to change “IgnoreUntrustedCertificate” to “true” but it still didn’t work.
image

Can anybody help me with this?

Hello @luiz.waldrich
How are you passing other information to the URL?
Do you pass any body?
What format are you using?

yes, I’m using this URL and this body. Also, I’m using:
Format: application/json

Thanks, which version of the Addon are you using?
Does it have any updates?


I have this one, version v1.6.2. I check the documentation, last merge to fix something was Nov 2 and I started to play around with TestProject this month, so, it is probably not an update issue.

I just double checked with an HTTP endpoint.
It seems to work fine, is there a way you can share your Endpoint with me?
We can continue this conversation over at the chat or over at support@testproject.io

Ok, I will send you via email as I cannot make this url public.

I am facing the same issue. I used a POST request in 1st step to generating a token for the user & in step 2 I am fetching some user-related data using GET API. (Token from 1st API is getting used as Authorization in step 2)

Hi @mhaskar16

The root of this problem was actually proxy in my VM (my local machine worked fine but VM didn’t). When I solved proxy issue in VM, it started to work. The unclear error message made me struggle a lot.

Double-check your proxy. See if you can do the same calls on Postman.

Hello @luiz.waldrich
We will release a new version of the addon today with improved error messages as well as other features like uploading a file directly over HTTP/HTTPS request.

1 Like

I am able to do the same task in POSTMAN, I can see all request parameter getting added correctly, but somehow it’s not getting sent. Is there any workaround for the above scenario? Because this is a blocker for me.

1st step to generating a token for the user & in step 2 I am fetching some user-related data using GET API. (Token from 1st API is getting used as Authorization in step 2)

here you have examples on how to do it with Bearer token RESTful API Client - TestProject Documentation

by the way you can also parametrize your calls and using 1st step data output as input in the second step (post)