New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

harproxyserver

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

harproxyserver - npm Package Compare versions

Comparing version 0.0.12 to 0.0.13

2

package.json
{
"name": "harproxyserver",
"version": "0.0.12",
"version": "0.0.13",
"description": "A simple proxy server that records and plays back HTTP requests and responses in HAR format.",

@@ -5,0 +5,0 @@ "author": "Yaacov Zamir <kobi.zamir@gmail.com>",

@@ -26,6 +26,2 @@ [![npm version](https://badge.fury.io/js/harproxyserver.svg)](https://badge.fury.io/js/harproxyserver)

## API
harproxyserver / [Exports](doc/modules.md)
## Standalone Executable

@@ -53,10 +49,49 @@

# In Your Project
## API
Import the server and utility functions in your project:
Import the server and utility functions in your TypeScript project:
``` ts
```ts
import { findHarEntry, recordedHarMiddleware } from 'harproxyserver';
```
Example 1: Using findHarEntry to find a specific GET request in a HAR log:
```ts
const harLog = ... // retrieve HAR log
const method = 'GET';
const pathname = '/api';
const entry = findHarEntry(harLog, method, pathname);
if (entry) {
console.log(`Found entry with ID ${entry.id}`);
} else {
console.log('Entry not found');
}
```
Example 2: Using findHarEntry to find a POST request with specific query parameters:
```ts
const harLog = ... // retrieve HAR log
const method = 'POST';
const baseUrl = 'https://example.com/api';
const queryParams = { q: 'search term', page: 1 };
const url = new URL(baseUrl);
for (const [key, value] of Object.entries(queryParams)) {
url.searchParams.set(key, value);
}
const pathnameWithParams = `${url.pathname}${url.search};
const entry = findHarEntry(harLog, method, pathnameWithParams);
if (entry) {
console.log(`Found entry with ID ${entry.id}`);
} else {
console.log('Entry not found');
}
```
# Command-Line Options

@@ -63,0 +98,0 @@

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