Hi,
How do we calculate "Content-Length" while consuming a POST REST call in PowerBuilder 2019 version? I have used LEN function to check the length of the body. But its not working. I have attached PB code for it. Could you please suggest a solution to this?
Regards,
Vishalakshi
ls_email = "abc@gmail.com"
ls_password = "1234"
ls_body = "email= " + ls_email + "&" + "password= " + ls_password
ls_url = "https://XXX/login/authenticate"
lnv_RestClient = CREATE RestClient
lnv_package = CREATE JsonPackage
ls_content_length = String(Len(ls_body)) //This is not giving the required data
lnv_RestClient.SetRequestHeader( "Content-Type","application/x-www-form-urlencoded")
lnv_RestClient.SetRequestHeader( "Host", "maven.gscmaven.com")
lnv_RestClient.SetRequestHeader( "Content-Length", ls_content_length)
li_rc = lnv_RestClient.SendPostRequest(ls_url, ls_body, ls_response)
Thank you. This solution worked! So, the problem was with Space, not on "Content-Length". Thank you very much for suggesting!