From 9701151115ebc172f186b4ec5a3bfbe9d551a7aa Mon Sep 17 00:00:00 2001 From: Gregor Martynus Date: Fri, 24 Jan 2020 13:16:46 -0800 Subject: [PATCH] fix: add `.endpoint()` method to all deprecated endpoint methods --- .../register-endpoints/register-endpoints.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/plugins/register-endpoints/register-endpoints.js b/plugins/register-endpoints/register-endpoints.js index 0ffd7844..153d4d1e 100644 --- a/plugins/register-endpoints/register-endpoints.js +++ b/plugins/register-endpoints/register-endpoints.js @@ -51,13 +51,16 @@ function registerEndpoints(octokit, routes) { } if (apiOptions.deprecated) { - octokit[namespaceName][apiName] = function deprecatedEndpointMethod() { - octokit.log.warn( - new Deprecation(`[@octokit/rest] ${apiOptions.deprecated}`) - ); - octokit[namespaceName][apiName] = request; - return request.apply(null, arguments); - }; + octokit[namespaceName][apiName] = Object.assign( + function deprecatedEndpointMethod() { + octokit.log.warn( + new Deprecation(`[@octokit/rest] ${apiOptions.deprecated}`) + ); + octokit[namespaceName][apiName] = request; + return request.apply(null, arguments); + }, + request + ); return; }