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

airbrake-mini-client

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

airbrake-mini-client - npm Package Compare versions

Comparing version 0.0.6 to 0.0.7

2

package.json
{
"name": "airbrake-mini-client",
"version": "0.0.6",
"version": "0.0.7",
"description": "A lightweight alternative to airbrake-js.",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -53,2 +53,3 @@ # airbrake-mini-client

* reporter: an object providing a "notify" method
* win: the window global object (default to the current window)

@@ -55,0 +56,0 @@ ### Filters

@@ -7,3 +7,3 @@ var objectAssign = require('object-assign')

name: 'airbrake-mini-client',
version: '0.0.6',
version: '0.0.7',
url: 'https://github.com/tes/airbrake-mini-client'

@@ -21,2 +21,3 @@ }

this.filters = []
this.win = config.win || window
}

@@ -29,5 +30,5 @@

notifier: NOTIFIER,
userAgent: window.navigator.userAgent,
url: window.location.href,
rootDirectory: window.location.protocol + '//' + window.location.host,
userAgent: this.win.navigator.userAgent,
url: this.win.location.href,
rootDirectory: this.win.location.protocol + '//' + this.win.location.host,
language: 'JavaScript',

@@ -34,0 +35,0 @@ environment: this.environment,

@@ -20,2 +20,3 @@ /* eslint-env browser */

this.timeout = config.timeout || DEFAULT_TIMEOUT
this.win = config.win || window
}

@@ -30,3 +31,3 @@

var url = this.host + '/api/v3/projects/' + this.projectId + '/notices?key=' + this.projectKey
let req = new XMLHttpRequest()
let req = new this.win.XMLHttpRequest()
req.open('POST', url, true)

@@ -33,0 +34,0 @@ req.timeout = this.timeout

@@ -70,2 +70,21 @@ /* eslint-env browser, mocha */

})
it('allows override of window', () => {
var userAgent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36'
var href = 'https://github.com/tes/airbrake-mini-client'
var protocol = 'https:'
var host = 'github.com'
var windowOverride = { navigator: { userAgent }, location: { href, protocol, host } }
airbrake = new AirbrakeMini({
projectId: '123',
projectKey: '456',
reporter: reporter,
win: windowOverride
})
var enrichedObject = airbrake.createInitialPayload()
assert.equal(enrichedObject.context.userAgent, userAgent)
assert.equal(enrichedObject.context.url, href)
assert.equal(enrichedObject.context.rootDirectory, `${protocol}//${host}`)
})
})
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