question

AmeyaB avatar image
AmeyaB asked AmeyaB answered

HTTP GET with a "?"

I am trying to execute a HTTP GET command. Executing the command using cURL works perfectly

C:\cURL>curl -H "Content-Type: application/json" -u "ameya.barve@spirent.com:Spirent123!" "https://spirent.testrail.net/index.php?/api/v2/get_case/1"

{"id":1,"title":"TestCase1","section_id":1,"type_id":7,"priority_id":2,"milestone_id":null,"refs":null,"created_by":1,"created_on":1445627870,"updated_by":1,"updated_on":1445629119,"estimate":null,"estimate_forecast":null,"suite_id":1,
om_preconds":"Some pre-conditions go here","custom_steps":"1. Connect to device via telnet\r\n2. Login using credentials provided\r\n3. Execute 'show version\" command\r\n4. VERIFY version is \"12.10\"","custom_expected":null}

In the HTTP session profile, I have set the username, password and the content-type (MIME). However I get the following issues when executing the same above command in the session:

  1. The URL has a "?" which throws iTest as entering a "?" during capture always displays the help
  2. If instead of capturing I execute the command using a test case, I get this error: "Connect to https://spirent.testrail.net/index.php?/api/v2/get_case/1 failed, reason: Server returned HTTP response code: 400 for URL: https://spirent.testrail.net/index.php?/api/v2/get_case/1"

Any ideas what I am doing wrong?

(Note: The above API is available publicly so you can try executing the same command)

iTesthttp
10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

AmeyaB avatar image
AmeyaB answered

Adding HTTP header on server code is not possible as we are attempting to connect to third-party server and have no access to their code.

Will downgrading my JDK to 6 have any other adverse effect for iTest 5.1?

10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

bhavani.geepalem avatar image
bhavani.geepalem answered

iTest fails to read the URL in a test case step due to the presence of "?" in it. As a temporary work around kindly do the following steps:

  • Add http header on server code
  • Replace JDK7 with JDK6

This issue is caused due to the up-gradation of JDK6 to JDK7 in iTest, refer this page for more information: HTTPS://forums.oracle.com/thread/2273788

10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.