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

@polka/send-type

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@polka/send-type - npm Package Compare versions

Comparing version 0.4.0 to 0.5.0

15

index.js
const { STATUS_CODES } = require('http');
const TYPE = 'Content-Type';
const TYPE = 'content-type';
const OSTREAM = 'application/octet-stream';
module.exports = function (res, code=200, data='', headers={}) {
let type = headers[TYPE];
let k, obj={};
for (k in headers) {
obj[k.toLowerCase()] = headers[k];
}
let type = obj[TYPE];
if (!!data && typeof data.pipe === 'function') {

@@ -23,7 +28,7 @@ res.setHeader(TYPE, type || OSTREAM);

headers[TYPE] = type || 'text/plain';
headers['Content-Length'] = Buffer.byteLength(data);
obj[TYPE] = type || 'text/plain';
obj['content-length'] = Buffer.byteLength(data);
res.writeHead(code, headers);
res.writeHead(code, obj);
res.end(data);
}
{
"name": "@polka/send-type",
"version": "0.4.0",
"version": "0.5.0",
"description": "A response helper that detects & handles Content-Types",

@@ -5,0 +5,0 @@ "repository": "lukeed/polka",

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