Minor fixes

This commit is contained in:
Justin Dalrymple 2018-03-21 14:39:01 -04:00
parent 1072a754f2
commit 688dc4e363
4 changed files with 16 additions and 6 deletions

View File

@ -145,6 +145,10 @@ This started off as a fork from [node-gitlab](https://github.com/node-gitlab/nod
[MIT](https://github.com/jdalrymple/node-gitlab-api/blob/master/LICENSE.md)
## Changelog
[2.2.6](https://github.com/jdalrymple/node-gitlab-api/tags/2.2.6) (2018-3-15)
------------------
- Fixed more issues within the url concatenation
[2.2.5](https://github.com/jdalrymple/node-gitlab-api/tags/2.2.5) (2018-3-15)
------------------
- Fixed #48 - Problem with trailing `\` in url
@ -175,7 +179,7 @@ This started off as a fork from [node-gitlab](https://github.com/node-gitlab/nod
how to run locally via npm linking for Development testing thanks to [Adam Dehnel](https://github.com/arsdehnel) in [PR #23](https://github.com/jdalrymple/node-gitlab-api/pull/23)
- Exposed the Merge Requests resource which was missing from the exports list thanks to [fewieden](https://github.com/fewieden) in [PR #26](https://github.com/jdalrymple/node-gitlab-api/pull/26)
- Added support for the Project Enviroments API and the Project Jobs API thanks to [Jeff Pelton](https://github.com/comster) in [PR #28](https://github.com/jdalrymple/node-gitlab-api/pull/28)
- Fixing parse function to handle encoded urls that dont include '/' such as in groups #24
- Fixing parse function to handle encoded urls that don't include '/' such as in groups #24
### Breaking Changes between 2.1.0 and 2.2.0
- Fixed a problem with the get responses where the response contained the full request response and not just the body

5
package-lock.json generated
View File

@ -5979,6 +5979,11 @@
"crypto-random-string": "1.0.0"
}
},
"url-join": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/url-join/-/url-join-4.0.0.tgz",
"integrity": "sha1-TTNA6AfTdzvamZH4MFrNzCpmXSo="
},
"util-deprecate": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",

View File

@ -1,6 +1,6 @@
{
"name": "node-gitlab-api",
"version": "2.2.5",
"version": "2.2.6",
"description": "Full NodeJS implementation of the GitLab API. Supports Promises, Async/Await.",
"main": "dist/latest/index.js",
"engines": {
@ -41,6 +41,7 @@
"parse-link-header": "^1.0.1",
"request": "^2.83.0",
"request-promise": "^4.2.2",
"tempy": "^0.2.1"
"tempy": "^0.2.1",
"url-join": "^4.0.0"
}
}

View File

@ -1,5 +1,5 @@
import Request from 'request-promise';
import URL from 'url';
import URLJoin from 'url-join';
import { Groups, Projects, Issues, Runners, Users, MergeRequests, Version } from './Models';
function defaultRequest(url, endpoint, {
@ -10,7 +10,7 @@ function defaultRequest(url, endpoint, {
resolveWithFullResponse = false,
}) {
const params = {
url: `${url}${endpoint}`,
url: URLJoin(url, endpoint),
headers,
json: true,
};
@ -26,7 +26,7 @@ function defaultRequest(url, endpoint, {
class API {
constructor({ url = 'https://gitlab.com', token, oauthToken }) {
this.url = URL.resolve(url, 'api/v4');
this.url = URLJoin(url, 'api', 'v4');
this.headers = {};
if (oauthToken) {