powerup-http-module

HTTP Request Getters hypothetical NPM module usage DEMO

A lightweight Node.js module that provides convenient getters for HTTP request properties. This module extends the functionality of the standard HTTP request object with easy-to-use getters for common request properties like cookies, body, query parameters, and more.

Features

Installation (not really)

Just make sure the node-modules folder includes the http-getters module folder with its index.js inside it. You can’t install it from the NPM normally as it isn’t published there.

image

Available Getters

image

Testing

You can test the module using curl commands, Postman, browser or any other way. Here are some examples:

1. Basic Request

curl 'http://localhost:3000/test'

2. Request with Query Parameters

curl 'http://localhost:3000/test?name=john&age=25'

3. Request with Cookies

curl -H 'Cookie: session=abc123; user=john' 'http://localhost:3000/test'

4. POST Request with JSON Body

curl -X POST \
  'http://localhost:3000/api/data?id=123' \
  -H 'Content-Type: application/json' \
  -H 'Cookie: session=xyz789' \
  -d '{"message": "Hello World"}'

Full Integration Test

This command tests all getters at once:

curl -X POST \
  'http://localhost:3000/test/path?key1=value1&key2=value2' \
  -H 'Cookie: session=abc123; user=john' \
  -H 'Content-Type: application/json' \
  -d '{"message": "Hello World"}'

Expected Responses

The server will log in its console:

Error Handling

Dependencies

Contributing

Feel free to submit issues and enhancement requests.

License

MIT