@@ -5,10 +5,6 @@ import { RequestError } from "@octokit/request-error";
55
66import { VERSION } from "./version" ;
77import { isIssueLabelsUpdateOrReplace } from "./is-issue-labels-update-or-replace" ;
8- import {
9- isGetReference ,
10- isListReferences ,
11- } from "./is-get-reference-or-list-references" ;
128
139export function enterpriseCompatibility ( octokit : Octokit ) {
1410 octokit . hook . wrap (
@@ -27,50 +23,6 @@ export function enterpriseCompatibility(octokit: Octokit) {
2723 return request ( options ) ;
2824 }
2925
30- const isGetReferenceRequest = isGetReference ( options ) ;
31- const isListReferencesRequest = isListReferences ( options ) ;
32- if ( isGetReferenceRequest || isListReferencesRequest ) {
33- options . url = options . url . replace (
34- / \/ r e p o s \/ ( [ ^ / ] + ) \/ ( [ ^ / ] + ) \/ g i t \/ ( r e f | m a t c h i n g - r e f s ) \/ ( .* ) $ / ,
35- "/repos/$1/$2/git/refs/$4"
36- ) ;
37- return request ( options )
38- . then ( ( response : OctokitResponse < any > ) => {
39- if ( isGetReferenceRequest ) {
40- if ( Array . isArray ( response . data ) ) {
41- throw new RequestError (
42- `More than one reference found at "${ options . url } "` ,
43- 404 ,
44- {
45- request : options ,
46- }
47- ) ;
48- }
49-
50- // ✅ received single reference
51- return response ;
52- }
53-
54- // make sure that
55- if ( ! Array . isArray ( response . data ) ) {
56- response . data = [ response . data ] ;
57- }
58-
59- return response ;
60- } )
61- . catch ( ( error : RequestError ) => {
62- if ( isListReferencesRequest && error . status === 404 ) {
63- return {
64- status : 200 ,
65- headers : error . headers ,
66- data : [ ] ,
67- } ;
68- }
69-
70- throw error ;
71- } ) ;
72- }
73-
7426 // TODO: implement fix for #62 here
7527
7628 // https://github.com/octokit/plugin-enterprise-compatibility.js/issues/60
@@ -88,7 +40,7 @@ export function enterpriseCompatibility(octokit: Octokit) {
8840
8941 const deprecatedUrl = options . url . replace (
9042 / \/ o r g s \/ [ ^ / ] + \/ t e a m s \/ [ ^ / ] + / ,
91- "/teams/: team_id"
43+ "/teams/{ team_id} "
9244 ) ;
9345
9446 throw new RequestError (
0 commit comments