Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

143
Views
HTTP client in Protractor not performing POST request

I tried the code below but unable to do the post request when passing the variable to the path

var projectId = browser.driver.findElement(By.xpath("//data[contains(text(),'0')]"));
projectId.getAttribute('value');
var projectIdValue = projectId.getText();
projectIdValue.then(function(text) {
console.log(text);
const http = new HttpClient("https://xxxx/abc/d/");
console.log("http object data:"+ http.baseUrl);
var postResponse = http.post("/"++projectIdValue,'{"jsonrpc": "2.0", "id": 1, "method": "some method", "params":["100000",true]}','"Content-Type": "application/json');
http.failOnError = true;
expect(postResponse.statusCode).toEqual(200);

Tried passing Variable directly its working fine:

 var projectIdValue = "127df5bc43a14059b2afa0aa78f19b0d";
//postResponse = http.post("/127df5bc43a14059b2afa0aa78f19b0d",'{"jsonrpc": "2.0", "id": 1, "method": "some method", "params":["0x989680",true]}','"Content-Type": "application/json');
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!