Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
testcafe-hammerhead
Advanced tools
A powerful web-proxy used as a core for the TestCafe testing framework (https://github.com/DevExpress/testcafe).
testcafe-hammerhead is a core library used by TestCafe to provide a proxy server that can intercept and modify HTTP requests and responses. It is primarily used for browser automation and testing, allowing you to simulate user actions and handle various web interactions.
HTTP Request Interception
Intercepts HTTP requests and allows you to modify them, such as adding custom headers.
const hammerhead = require('testcafe-hammerhead');
hammerhead.onRequest((req, res) => {
if (req.url.includes('example.com')) {
res.setHeader('X-Custom-Header', 'CustomValue');
}
});
HTTP Response Modification
Intercepts HTTP responses and allows you to modify the response body.
const hammerhead = require('testcafe-hammerhead');
hammerhead.onResponse((req, res) => {
if (req.url.includes('example.com')) {
res.body = res.body.replace('old text', 'new text');
}
});
Cookie Management
Allows you to manage cookies by setting them in the HTTP response headers.
const hammerhead = require('testcafe-hammerhead');
hammerhead.onRequest((req, res) => {
if (req.url.includes('example.com')) {
res.setHeader('Set-Cookie', 'name=value; Path=/; HttpOnly');
}
});
Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the DevTools Protocol. It can be used for browser automation and testing, similar to testcafe-hammerhead, but it operates at a higher level and provides more direct control over the browser.
Selenium WebDriver is a tool for automating web application testing, and it allows you to control a browser programmatically. It is similar to testcafe-hammerhead in that it can be used for browser automation, but it supports a wider range of browsers and programming languages.
Cypress is a JavaScript end-to-end testing framework that aims to make testing fast, easy, and reliable. It provides a similar functionality to testcafe-hammerhead but with a more user-friendly API and built-in features for time travel and debugging.
testcafe-hammerhead
is a powerful Web proxy used as a core for the TestCafe testing framework.
testcafe-hammerhead
is a URL-rewriting proxy. This means that it rewrites all properties of the appropriate JavaScript objects that contain a URL value (Location
, HTMLLinkElement.href
, etc). You can see it if you open a proxied page, invoke the browser's DevTools and inspect any element.
In addition, the proxied web page does not know that it is opened under a proxy. The proxy intercepts access attempts to all URL-containing properties and provides the original values.
git clone https://github.com/DevExpress/testcafe-hammerhead.git
testcafe-hammerhead
folder
cd testcafe-hammerhead
npm install
node node_modules/gulp/bin/gulp http-playground
This opens a playground page where you can specify a webpage to proxy. Enter the page URL and hit Proxy!.
onRequest
, onResponse
)Read our Contributing Guide to learn how to contribute to the project.
FAQs
A powerful web-proxy used as a core for the TestCafe testing framework (https://github.com/DevExpress/testcafe).
The npm package testcafe-hammerhead receives a total of 157,519 weekly downloads. As such, testcafe-hammerhead popularity was classified as popular.
We found that testcafe-hammerhead demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.