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

@tinyhttp/send

Package Overview
Dependencies
Maintainers
1
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tinyhttp/send - npm Package Compare versions

Comparing version 1.2.6 to 1.3.0

24

dist/index.js

@@ -53,16 +53,17 @@ import { format, parse } from 'es-content-type';

let bodyToSend = body;
// in case of object - turn it to json
if (typeof body === 'object' && body !== null) {
if (Buffer.isBuffer(body)) {
bodyToSend = body;
}
else if (typeof body === 'object' && body !== null) {
// in case of object - turn it to json
bodyToSend = JSON.stringify(body, null, 2);
}
else {
if (typeof body === 'string') {
// reflect this in content-type
const type = res.getHeader('Content-Type');
if (type && typeof type === 'string') {
res.setHeader('Content-Type', setCharset(type, 'utf-8'));
}
else
res.setHeader('Content-Type', setCharset('text/html', 'utf-8'));
else if (typeof body === 'string') {
// reflect this in content-type
const type = res.getHeader('Content-Type');
if (type && typeof type === 'string') {
res.setHeader('Content-Type', setCharset(type, 'utf-8'));
}
else
res.setHeader('Content-Type', setCharset('text/html', 'utf-8'));
}

@@ -95,2 +96,3 @@ // Set encoding

res.setHeader('content-type', 'application/octet-stream');
res.end(bodyToSend);
}

@@ -97,0 +99,0 @@ else

{
"name": "@tinyhttp/send",
"version": "1.2.6",
"version": "1.3.0",
"type": "module",

@@ -39,3 +39,3 @@ "description": "json, send, sendFile, status and sendStatus methods for tinyhttp",

"dependencies": {
"@tinyhttp/etag": "1.2.2",
"@tinyhttp/etag": "1.3.0",
"es-content-type": "^0.0.10",

@@ -42,0 +42,0 @@ "es-mime-types": "^0.0.16"

Sorry, the diff of this file is not supported yet

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