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

dev-echo-server

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dev-echo-server

Echo server. For development purposes only.

  • 0.2.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

dev-echo-server

Simple echo server for development purposes.

Mainly developed to help with the testing of:

  • prxi - zero runtime dependency HTTP, HTTP/2 proxy library
  • prxi-openid-connect - OpenID Connect reverse proxy for HTTP, HTTP/2 connections

Supports:

  • HTTP
  • HTTPS
  • HTTP/2 h2c
  • HTTP/2
  • WS
  • WSS

Usage

npm i -g dev-echo-server

# generate certificate and key
openssl req -x509 -newkey rsa:2048 -nodes -sha256 -subj '/CN=localhost' -keyout key.pem -out cert.pem

export PATH_CERT=cert.pem
export PATH_KEY=key.pem

dev-echo-server

Ports

PortProtocolEnvironment Variable
7001HTTPPORT_HTTP
7002HTTPSPORT_HTTPS
7003HTTP/2 h2cPORT_HTTP2_H2C
7004HTTP/2PORT_HTTP2

Headers

X-Add-Headers

x-add-headers Header can be used to add additional headers to the response. Value should be a JSON object.

Example:

curl http://localhost:7001 \
  -H 'x-add-headers: {"test": "test"}'

Invocation examples

CURL Scripts

# HTTP
curl http://localhost:7001/\?a\=b 

# HTTPS
curl https://localhost:7002/\?a\=b -k

# HTTP/2 h2c
# Upgrade for h2c is not supported by node thus `--http2-prior-knowledge` should be used
curl --http2-prior-knowledge http://localhost:7003/\?a\=b 

# HTTP/2
curl --http2 https://localhost:7004/\?a\=b -k

Socket.IO CLI

npm i -g socket.io-cli

# expose env to trust self-signed certificate
export NODE_EXTRA_CA_CERTS=cert.pem 

# HTTP
socketio http://localhost:7001 

# HTTPS
socketio https://localhost:7002

# HTTP/2 h2c - NOT SUPPORTED

# HTTP/2
socketio https://localhost:7004

# Once connected just type <event> [args] and hit enter

Keywords

FAQs

Package last updated on 13 Dec 2023

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