Skip to content

OpenFn/nodejs-redirect-test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚀 Node.js Redirect Test with Undici

This project contains:

  • A simple HTTP server with two endpoints:
    • /redirect: responds with a 302 redirect to /final
    • /final: responds with a 200 OK and a message
  • A custom undici.Client with redirect handling logic using RedirectHandler

🧱 Project Structure

project-root/ ├── server.js # HTTP server that serves /redirect and /final ├── client.js # Undici client with redirect logic ├── package.json 


📦 Prerequisites

  • Node.js v18+ (Undici is built-in)
  • For Node.js < 18, install undici manually:
  npm install undici

▶️ How to Run

1. Start the Server

Open a terminal and run:

node server.js

This starts the HTTP server on http://localhost:3000

You can test it in your browser:

1. Run the Client

In a separate terminal, run:

node client.js

To see the full url with the extra slash run:

NODE_DEBUG=undici node client.js 

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published