@anzerr/http.server
Advanced tools
Comparing version 1.0.8 to 1.0.12
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); |
Git dependency
Supply chain riskContains a dependency which resolves to a remote git URL. Dependencies fetched from git URLs are not immutable can be used to inject untrusted code or reduce the likelihood of a reproducible install.
Found 2 instances in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
0
24
0
1
6734
8
190
+ Added@anzerr/clone.util@^1.0.9
+ Added@anzerr/mime.util@^1.0.7
+ Added@anzerr/clone.util@1.0.14(transitive)
+ Added@anzerr/mime.util@1.0.12(transitive)
+ Added@anzerr/type.util@1.0.17(transitive)
- Removedclone.util@git+https://git@github.com/anzerr/clone.util.git
- Removedmime.util@git+https://git@github.com/anzerr/mime.util.git