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

xhr

Package Overview
Dependencies
Maintainers
2
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xhr - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

test/TODO

7

index.js

@@ -49,4 +49,4 @@ "use strict";

clearTimeout(timeoutTimer)
if(! evt instanceof Error){
evt = new Error(""+evt)
if(!(evt instanceof Error)){
evt = new Error("" + (evt || "unknown") )
}

@@ -89,2 +89,5 @@ evt.statusCode = 0

options = options || {}
if(typeof callback === "undefined"){
throw new Error("callback argument missing")
}
callback = once(callback)

@@ -91,0 +94,0 @@

{
"name": "xhr",
"version": "2.0.0",
"version": "2.0.1",
"description": "small xhr abstraction",

@@ -5,0 +5,0 @@ "keywords": [

@@ -104,2 +104,21 @@ var window = require("global/window")

assert.end()
})
test("handles errorFunc call with no arguments provided", function (assert) {
var req = xhr({}, function (err) {
assert.ok(err instanceof Error, "callback should get an error")
assert.equal(err.message, "unknown", "error message should say 'unknown'")
})
assert.doesNotThrow(function () {
req.onerror()
}, "should not throw when error handler called without arguments")
assert.end()
})
test("constructs and calls callback without throwing", function (assert) {
assert.throws(function () {
xhr({})
}, "callback is not optional")
assert.end()
})
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