Socket
Socket
Sign inDemoInstall

@anzerr/http.server

Package Overview
Dependencies
3
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.8 to 1.0.12

4

index.js
module.exports = {
Server: require('./src/server.js'),
Config: require('./src/config.js')
Config: require('./src/config.js'),
Request: require('./src/request.js'),
Response: require('./src/response.js')
};
{
"name": "@anzerr/http.server",
"version": "1.0.8",
"version": "1.0.12",
"description": "Simple http server",
"keywords": [],

@@ -18,13 +19,13 @@ "homepage": "https://github.com/anzerr/http.server#readme",

"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "node example.js"
},
"eslintConfig": {
"extends": "eslint-config-basic"
"extends": "@anzerr/eslint-config-basic"
},
"dependencies": {
"mime.util": "git+https://git@github.com/anzerr/mime.util.git",
"clone.util": "git+https://git@github.com/anzerr/clone.util.git"
"@anzerr/mime.util": "^1.0.7",
"@anzerr/clone.util": "^1.0.9"
},
"devDependencies": {
"eslint-config-basic": "git+https://git@github.com/anzerr/eslintrc.git"
"@anzerr/eslint-config-basic": "^1.0.10"
},

@@ -34,2 +35,2 @@ "engines": {

}
}
}
### `Intro`
![GitHub Actions status | publish](https://github.com/anzerr/http.server/workflows/publish/badge.svg)
Simple http server interface

@@ -4,0 +6,0 @@

const url = require('url'),
copy = require('clone.util'),
copy = require('@anzerr/clone.util'),
querystring = require('querystring');

@@ -5,0 +5,0 @@

const mime = require('mime.util');
const mime = require('@anzerr/mime.util');
class Response {
constructor(res) {
constructor(res, req) {
this._res = res;

@@ -14,3 +14,3 @@

'Content-Type': 'text/plain',
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Origin': req.headers.origin || '*',
'Access-Control-Allow-Methods': 'GET,POST,PUT,DELETE,OPTIONS',

@@ -55,7 +55,6 @@ 'Access-Control-Allow-Headers': 'Cache-Control, Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With'

json(body) {
let json = JSON.stringify(body, null, '\t');
json(body, format = false) {
let json = format? JSON.stringify(body, null, '\t') : JSON.stringify(body);
return (this.set({
'Content-Type': mime.lookup('json'),
'Content-Length': Buffer.byteLength(json)
'Content-Type': mime.lookup('json')
}).send(json || ''));

@@ -62,0 +61,0 @@ }

@@ -23,3 +23,3 @@

let server = http.createServer((req, res) => {
return cd(new Request(req), new Response(res));
return cd(new Request(req), new Response(res, req));
}).listen(this.port, () => {

@@ -26,0 +26,0 @@ resolve(server);

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc