Gathering detailed insights and metrics for protractor-http-client
Gathering detailed insights and metrics for protractor-http-client
npm install protractor-http-client
Typescript
Module System
Node Version
NPM Version
80.1
Supply Chain
92.9
Quality
71.6
Maintenance
50
Vulnerability
97.9
License
TypeScript (84.82%)
JavaScript (15.18%)
Love this project? Help keep it running — sponsor us today! 🚀
Total Downloads
3,034,841
Last Day
1,268
Last Week
5,858
Last Month
25,971
Last Year
397,158
6 Stars
38 Commits
5 Forks
3 Watching
1 Branches
2 Contributors
Minified
Minified + Gzipped
Latest Version
1.0.4
Package Id
protractor-http-client@1.0.4
Unpacked Size
18.57 kB
Size
6.13 kB
File Count
11
NPM Version
3.10.8
Node Version
6.9.1
Cumulative downloads
Total Downloads
Last day
-3.1%
1,268
Compared to previous day
Last week
-12.2%
5,858
Compared to previous week
Last month
0.1%
25,971
Compared to previous month
Last year
-39.7%
397,158
Compared to previous year
1
HTTP Client library to use in protractor tests
Are you using protractor ? me too, and it's awesome! This library is a little utility that allows you to make any HTTP call (GET, PUT, POST, ...) , leveraging the powerful request library.
This library allows you to call HTTP services before, after or during interactions within the browser.
for example, for setting up test data via REST API before a test is run, or cleaning up after a test has finished running.
It won't be easy to do the same with plain 'http' or 'request' module, as you will have to wait for the HTTP call promise to complete, before using the protractor browser calls.
Instead, you have to just call e.g.
1http.post("/database/users", { 2 username: "marco", password: "bigsecret" 3}) 4browser.get("/login") // this will wait for the previous call to finish 5// initiate login with "marco" user
and the subsequent calls to protractor API will wait until the previous call finishes.
If using Javascript specs
1const HttpClient = require("protractor-http-client").HttpClient
If using Typescript specs
1import {HttpClient} from "protractor-http-client"
1const http = new HttpClient("https://example.com/") 2 3// HTTP GET 4const userGetResponse:ResponsePromise = http.get("/users/marco"); 5// HTTP POST with JSON, automatically sets Content-Type: application/json 6http.post("/users", { 7 username: "marco", password: "bigsecret" 8})); 9// HTTP POST, with form data and custom content type 10http.post("/form", "param1=value1¶m2=value2", { 11 "Content-Type": "application/x-www-form-urlencoded" 12})); 13// make HTTP calls fail and throw an exception when response code is not 2xx 14// default behavior is to continue on any HTTP status code 15http.failOnError = true
You have get
, post
, put
, delete
methods available.
get
and delete
methods do NOT accept request body.
For more complex requests, use the request
method shown below.
You can pass any options accepted by the request library, by passing an object to the request method
1let options = { .... } 2http.request(options)
1let response:ResponsePromise = http.get("/users/marco") 2let jsonResponse:JsonPromise = response.jsonBody 3let stringBody:Promise<string> = response.stringBody 4let rawBody:Promise<Buffer> = response.body 5 6let jsonPropertyValue:JsonPromise = response.jsonBody.get("propertyName") 7 8expect(response.statusCode).toEqual(200) 9expect(response.header("Content-Type")).toEqual("application/json") 10expect(response.stringBody).toEqual('{"username":"marco","password":"bigsecret"}') 11expect(response.jsonBody.get("username")).toEqual("marco")
1describe("the login page", () => { 2 beforeEach(() => { 3 // create a user 4 const postResponse = http.post("/users", { 5 username: "marco", password: "bigsecret" 6 }); 7 expect(postResponse.statusCode).toEqual(200) 8 }) 9 afterEach(() => { 10 // delete user 11 const deleteResponse = http.delete("/users/marco"); 12 expect(deleteResponse.statusCode).toEqual(200) 13 }) 14 15 it("will allow login with new user", () => { 16 // now you can use the browser to login with the new user 17 browser.get("/login"); 18 element(by.id("username")).sendKeys("marco") 19 element(by.id("password")).sendKeys("bigsecret") 20 element(by.id("login-button")).click() 21 // expectations here 22 }) 23})
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 1/28 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-01-27
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More