Skip to content

Commit

Permalink
Merge pull request #979 from minijus/master
Browse files Browse the repository at this point in the history
BitBucket Server: use REST API for raw file requests
  • Loading branch information
orta committed Feb 20, 2020
2 parents cda717e + 823a1aa commit 0a1aaeb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion source/platforms/bitbucket_server/BitBucketServerAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ export class BitBucketServerAPI implements BitBucketServerAPIDSL {

// The last two are "optional" in the protocol, but not really optional WRT the BBSAPI
getFileContents = async (filePath: string, repoSlug?: string, refspec?: string) => {
const path = `${repoSlug}/` + `raw/${filePath}` + `?at=${refspec}`
const path = `rest/api/1.0/${repoSlug}/` + `raw/${filePath}` + `?at=${refspec}`
const res = await this.get(path, undefined, true)
if (res.status === 404) {
return ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ describe("API testing - BitBucket Server", () => {
const result = await api.getFileContents("path/to/foo.txt", "projects/FOO/repos/BAR", "master")

expect(api.fetch).toHaveBeenCalledWith(
`${host}/projects/FOO/repos/BAR/raw/path/to/foo.txt?at=master`,
`${host}/rest/api/1.0/projects/FOO/repos/BAR/raw/path/to/foo.txt?at=master`,
{ method: "GET", body: null, headers: expectedJSONHeaders },
true
)
Expand Down

0 comments on commit 0a1aaeb

Please sign in to comment.