diff --git a/index.js b/index.js index d717264..b42a6ed 100644 --- a/index.js +++ b/index.js @@ -9,7 +9,6 @@ const joi = require('joi'); const url = require('url'); const request = require('request'); const schema = require('screwdriver-data-schema'); -const API_URL_V1 = 'https://api.bitbucket.org/1.0'; const API_URL_V2 = 'https://api.bitbucket.org/2.0'; const REPO_URL = `${API_URL_V2}/repositories`; const USER_URL = `${API_URL_V2}/users`; @@ -523,7 +522,7 @@ class BitbucketScm extends Scm { _getFile(config) { const scm = getScmUriParts(config.scmUri); const branch = config.ref || scm.branch; - const fileUrl = `${API_URL_V1}/repositories/${scm.repoId}/src/${branch}/${config.path}`; + const fileUrl = `${API_URL_V2}/repositories/${scm.repoId}/src/${branch}/${config.path}`; const options = { url: fileUrl, method: 'GET', diff --git a/test/index.test.js b/test/index.test.js index 791f978..337d4a1 100644 --- a/test/index.test.js +++ b/test/index.test.js @@ -13,7 +13,6 @@ const testPayloadSync = require('./data/pr.sync.json'); const testPayloadClose = require('./data/pr.closed.json'); const testPayloadPush = require('./data/repo.push.json'); const token = 'myAccessToken'; -const API_URL_V1 = 'https://api.bitbucket.org/1.0'; const API_URL_V2 = 'https://api.bitbucket.org/2.0'; sinon.assert.expose(assert, { prefix: '' }); @@ -816,7 +815,7 @@ describe('index', function () { }); describe('getFile', () => { - const apiUrl = `${API_URL_V1}/repositories/repoId/src/branchName/path/to/file.txt`; + const apiUrl = `${API_URL_V2}/repositories/repoId/src/branchName/path/to/file.txt`; const scmUri = 'hostName:repoId:branchName'; const params = { scmUri,