Comparing version 7.0.0 to 7.1.0
@@ -15,3 +15,3 @@ 'use strict'; | ||
token: env.GITHUB_TOKEN, | ||
endpoint: env.GITHUB_ENDPOINT ? env.GITHUB_ENDPOINT.replace(/[^/]$/, '$&/') : 'https://api.github.com/' | ||
endpoint: env.GITHUB_ENDPOINT ? env.GITHUB_ENDPOINT : 'https://api.github.com/' | ||
}, opts); | ||
@@ -33,3 +33,3 @@ | ||
const url = /^https?/.test(path) ? path : opts.endpoint + path; | ||
const url = /^https?/.test(path) ? path : opts.endpoint.replace(/\/$/, '') + '/' + path.replace(/^\//, ''); | ||
@@ -36,0 +36,0 @@ if (opts.stream) { |
{ | ||
"name": "gh-got", | ||
"version": "7.0.0", | ||
"description": "Convenience wrapper for Got to interact with the GitHub API", | ||
"license": "MIT", | ||
"repository": "sindresorhus/gh-got", | ||
"author": { | ||
"name": "Sindre Sorhus", | ||
"email": "sindresorhus@gmail.com", | ||
"url": "sindresorhus.com" | ||
}, | ||
"engines": { | ||
"node": ">=4" | ||
}, | ||
"scripts": { | ||
"test": "xo && ava" | ||
}, | ||
"files": [ | ||
"index.js" | ||
], | ||
"keywords": [ | ||
"got", | ||
"gh", | ||
"github", | ||
"api", | ||
"request", | ||
"http", | ||
"https", | ||
"get", | ||
"url", | ||
"uri", | ||
"util", | ||
"utility" | ||
], | ||
"dependencies": { | ||
"got": "^8.0.0", | ||
"is-plain-obj": "^1.1.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "*", | ||
"get-stream": "^3.0.0", | ||
"nock": "^9.1.0", | ||
"xo": "*" | ||
} | ||
"name": "gh-got", | ||
"version": "7.1.0", | ||
"description": "Convenience wrapper for `got` to interact with the GitHub API", | ||
"license": "MIT", | ||
"repository": "sindresorhus/gh-got", | ||
"author": { | ||
"name": "Sindre Sorhus", | ||
"email": "sindresorhus@gmail.com", | ||
"url": "sindresorhus.com" | ||
}, | ||
"engines": { | ||
"node": ">=4" | ||
}, | ||
"scripts": { | ||
"test": "xo && ava" | ||
}, | ||
"files": [ | ||
"index.js" | ||
], | ||
"keywords": [ | ||
"got", | ||
"gh", | ||
"github", | ||
"api", | ||
"request", | ||
"http", | ||
"https", | ||
"get", | ||
"url", | ||
"uri", | ||
"util", | ||
"utility" | ||
], | ||
"dependencies": { | ||
"got": "^8.0.0", | ||
"is-plain-obj": "^1.1.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "*", | ||
"get-stream": "^3.0.0", | ||
"nock": "^9.1.0", | ||
"xo": "*" | ||
} | ||
} |
@@ -21,12 +21,14 @@ # gh-got [![Build Status](https://travis-ci.org/sindresorhus/gh-got.svg?branch=master)](https://travis-ci.org/sindresorhus/gh-got) | ||
got('https://api.github.com/users/sindresorhus', { | ||
json: true, | ||
headers: { | ||
'accept': 'application/vnd.github.v3+json', | ||
'authorization': `token ${token}` | ||
} | ||
}).then(res => { | ||
console.log(res.body.login); | ||
(async () => { | ||
const {body} = await got('https://api.github.com/users/sindresorhus', { | ||
json: true, | ||
headers: { | ||
'accept': 'application/vnd.github.v3+json', | ||
'authorization': `token ${token}` | ||
} | ||
}); | ||
console.log(body.login); | ||
//=> 'sindresorhus' | ||
}); | ||
})(); | ||
``` | ||
@@ -39,6 +41,8 @@ | ||
ghGot('users/sindresorhus', {token: 'foo'}).then(res => { | ||
console.log(res.body.login); | ||
(async () => { | ||
const {body} = await ghGot('users/sindresorhus', {token: 'foo'}); | ||
console.log(body.login); | ||
//=> 'sindresorhus' | ||
}); | ||
})(); | ||
``` | ||
@@ -51,6 +55,8 @@ | ||
ghGot('https://api.github.com/users/sindresorhus', {token: 'foo'}).then(res => { | ||
console.log(res.body.login); | ||
(async () => { | ||
const {body} = await ghGot('https://api.github.com/users/sindresorhus', {token: 'foo'}); | ||
console.log(body.login); | ||
//=> 'sindresorhus' | ||
}); | ||
})(); | ||
``` | ||
@@ -57,0 +63,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5301
95