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 1.0.0 to 1.1.0

test/defaults-test.js

31

index.js

@@ -1,25 +0,28 @@

module.exports = restRequest
const restEndpoint = require('@octokit/endpoint')
const endpoint = require('@octokit/endpoint')
const fetch = require('node-fetch').default
const getUserAgent = require('universal-user-agent')
const request = require('./lib/request')
const getUserAgent = require('universal-user-agent')
const version = require('./package.json').version
const userAgent = `octokit-request.js/${version} ${getUserAgent()}`
function restRequest (route, options) {
const requestOptions = restEndpoint.apply(null, arguments)
function octokitRequest (endpoint, route, options) {
return request(module.exports.fetch, endpoint(route, options))
}
// override the default user-agent header set by @octokit/endpoit
if (/^octokit-endpoint.js/.test(requestOptions.headers['user-agent'])) {
requestOptions.headers['user-agent'] = userAgent
function withDefaults (oldEndpoint, newDefaults) {
const endpoint = oldEndpoint.defaults(newDefaults)
const request = octokitRequest.bind(null, endpoint)
request.endpoint = endpoint
request.defaults = withDefaults.bind(null, endpoint)
return request
}
module.exports = withDefaults(endpoint, {
headers: {
'user-agent': userAgent
}
})
return request(module.exports.fetch, requestOptions)
}
// expose internally used `fetch` method for testing/mocking only
module.exports.fetch = fetch
{
"name": "@octokit/request",
"version": "1.0.0",
"version": "1.1.0",
"publishConfig": {

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

@@ -236,3 +236,3 @@ # request.js

const myOctokitRequest = require('@octokit/request').defaults({
baseUrl: 'http://github-enterprise.acme-inc.com/api/v3',
baseUrl: 'https://github-enterprise.acme-inc.com/api/v3',
headers: {

@@ -253,3 +253,3 @@ 'user-agent': 'myApp/1.2.3',

const myProjectRequest = request.defaults({
baseUrl: 'http://github-enterprise.acme-inc.com/api/v3',
baseUrl: 'https://github-enterprise.acme-inc.com/api/v3',
headers: {

@@ -271,2 +271,6 @@ 'user-agent': 'myApp/1.2.3'

## `request.endpoint`
See https://github.com/octokit/endpoint.js
## Special cases

@@ -273,0 +277,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