Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

testcafe-hammerhead

Package Overview
Dependencies
Maintainers
2
Versions
350
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

testcafe-hammerhead

A powerful web-proxy used as a core for the TestCafe testing framework (https://github.com/DevExpress/testcafe).

  • 3.1.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
50K
decreased by-81.13%
Maintainers
2
Weekly downloads
 
Created

What is testcafe-hammerhead?

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.

What are testcafe-hammerhead's main functionalities?

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');
  }
});

Other packages similar to testcafe-hammerhead

FAQs

Package last updated on 10 Dec 2015

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc