New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

send-data

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

send-data - npm Package Compare versions

Comparing version 2.1.1 to 2.2.1

docs.mli

6

html.js

@@ -5,8 +5,2 @@ var send = require("./index")

/* sendHtml := (HttpRequest, HttpResponse, String | {
body: String,
headers?: Object<String, String>,
statusCode?: Number
})
*/
function sendHtml(req, res, html) {

@@ -13,0 +7,0 @@ if (typeof html !== "object") {

16

json.js

@@ -5,9 +5,3 @@ var send = require("./index")

/* sendJson := (HttpRequest, HttpResponse, Value | {
body: Value,
headers?: Object<String, String>,
statusCode?: Number
})
*/
function sendJson(req, res, value) {
function sendJson(req, res, value, opts) {
if (!value || (!value.statusCode && !value.headers)) {

@@ -17,4 +11,10 @@ value = { body: value }

opts = opts || {}
if (opts.pretty) {
opts.space = " "
}
value.headers = value.headers || {}
value.body = JSON.stringify(value.body)
value.body = JSON.stringify(value.body,
opts.replacer || null, opts.space || "")
value.headers["Content-Type"] = "application/json"

@@ -21,0 +21,0 @@

{
"name": "send-data",
"version": "2.1.1",
"version": "2.2.1",
"description": "send data through response",

@@ -21,7 +21,4 @@ "keywords": [],

"devDependencies": {
"tap": "~0.3.1",
"test-server": "~0.1.1",
"tape": "~0.3.3",
"request": "~2.20.0",
"xtend": "~2.0.3"
"tape": "~1.0.4"
},

@@ -28,0 +25,0 @@ "licenses": [

@@ -50,33 +50,2 @@ # send-data [![build status][1]][2]

## Docs
```ocaml
send-data := (HttpRequest, HttpResponse, Buffer | String | {
headers?: Object<String, String>,
body?: Buffer | String,
statusCode?: Number
})
send-data/json := (HttpRequest, HttpResponse, Value | {
body: Value,
headers?: Object<String, String>,
statusCode?: Number
})
send-data/html := (HttpRequest, HttpResponse, String | {
body: String,
headers?: Object<String, String>,
statusCode?: Number
})
type ErrorObject := { attribute: String, message: String }
type MaybeErrorObject := Array<ErrorObject> | String | Error
send-data/error := (HttpRequest, HttpResponse, MaybeErrorObject | {
body: MaybeErrorObject,
statusCode?: Number,
headers?: Object<String, String>
})
```
## Installation

@@ -83,0 +52,0 @@

@@ -64,2 +64,3 @@ var test = require("tape")

request("/json", function (err, res, body) {
console.log("wut", res.statusCode)
var data = JSON.parse(body)

@@ -66,0 +67,0 @@

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