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

@octokit/request

Package Overview
Dependencies
Maintainers
3
Versions
104
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@octokit/request - npm Package Compare versions

Comparing version 2.0.1 to 2.1.0

10

lib/http-error.js
module.exports = class HttpError extends Error {
constructor (message, code, headers) {
constructor (message, statusCode, headers) {
super(message)

@@ -12,5 +12,11 @@

this.name = 'HttpError'
this.code = code
this.status = statusCode
Object.defineProperty(this, 'code', {
get () {
console.warn('`error.code` is deprecated, use `error.status`.')
return statusCode
}
})
this.headers = headers
}
}

2

package.json
{
"name": "@octokit/request",
"version": "2.0.1",
"version": "2.1.0",
"publishConfig": {

@@ -5,0 +5,0 @@ "access": "public"

@@ -162,3 +162,3 @@ const chai = require('chai')

.catch(error => {
expect(error.code).to.equal(404)
expect(error.status).to.equal(404)
})

@@ -227,3 +227,3 @@ })

.catch(error => {
expect(error.code).to.equal(304)
expect(error.status).to.equal(304)
})

@@ -245,3 +245,3 @@ })

.catch(error => {
expect(error.code).to.equal(404)
expect(error.status).to.equal(404)
})

@@ -285,3 +285,3 @@ })

.catch(error => {
expect(error.code).to.equal(500)
expect(error.status).to.equal(500)
})

@@ -354,3 +354,3 @@ })

.catch(error => {
expect(error.code).to.equal(422)
expect(error.status).to.equal(422)
expect(error.headers['x-foo']).to.equal('bar')

@@ -361,2 +361,19 @@ expect(error.documentation_url).to.equal('https://developer.github.com/v3/issues/labels/#create-a-label')

})
it('error.code (deprecated)', () => {
mockable.fetch = fetchMock.sandbox()
.get('path:/orgs/nope', 404)
return octokitRequest('GET /orgs/:org', {
org: 'nope'
})
.then(() => {
throw new Error('should not resolve')
})
.catch(error => {
expect(error.code).to.equal(404)
})
})
})
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