Forum Discussion

Aditya_Mehra's avatar
Jul 25, 2018

/n is added at the end of a GET to the server causing bad request

For the below part of the iAPP, when the send request goes to the server a \n is added at the end of the $api_url (value) example abc/cdf/123\n. Due to this 400 bad request is received from the server and connection terminates.

 

set send_data \"GET \$api_url HTTP/1.1\r\nHost: \$api_host\r\nConnection: Close\r\n\r\n"

 

Tried the below to trim the \n at the end but its not working.

 

string trimright \$api_url;

 

string trim \$api_url "*\n"

 

string trim \$api_url "\n"

 

string range \$api_url 0 end-2

 

Need help in what can be used to remove the \n from the GET request.