From 688dc4e363b27197d9643669ea4142211d5ea4da Mon Sep 17 00:00:00 2001 From: Justin Dalrymple Date: Wed, 21 Mar 2018 14:39:01 -0400 Subject: [PATCH] Minor fixes --- README.md | 6 +++++- package-lock.json | 5 +++++ package.json | 5 +++-- src/API.js | 6 +++--- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index d9086485..8536bed5 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/package-lock.json b/package-lock.json index a4ec814b..a04d8805 100644 --- a/package-lock.json +++ b/package-lock.json @@ -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", diff --git a/package.json b/package.json index ce92ac4d..2d613562 100644 --- a/package.json +++ b/package.json @@ -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" } } diff --git a/src/API.js b/src/API.js index 11d4f90b..3f72ca7e 100644 --- a/src/API.js +++ b/src/API.js @@ -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) {