You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fabzo
changed the title
Octokit Example not working for "Update a webhook configuration for a repository"
Octokit example not working for "Update a webhook configuration for a repository"
Sep 8, 2021
This endpoint is unfortunately a special case. It did not exist when I created octokit.request originally. I think it would make sense to change Octokit's behavior at this point, I created a follow up issue here so you can track it. octokit/request.js#425
The Octokit examples are generated, some of them are not quite correct. Adding manual overwrites would introduce quite a lot of complexity and maintenance overhead, I'd rather not do that, but wait for me to address the problem with the url parameter in Octokit itself
Thanks for following up @gr2m and thanks for opening this issue @fabzo ! Since this will be fixed in the octokit repo, I am going to close out this issue.
Code of Conduct
What article on docs.github.com is affected?
https://docs.github.com/en/rest/reference/repos#update-a-webhook-configuration-for-a-repository
What part(s) of the article would you like to see updated?
The current example code reads as follows:
But Octokit will interpret all first level attributes of the options object as configuration parameters if applicable. From my understanding it will take the 'url' attribute from the options object and ignore the request path. See https://github.com/octokit/endpoint.js/blob/master/src/merge.ts#L14 as well as https://github.com/octokit/endpoint.js/blob/master/src/parse.ts#L76
The example resulted in my code trying to send the request to the provided webhook URL instead of the GitHub API.
The working code looks as follows:
Unfortunately I could not find the location of the code example in the documentation and thus was unable to propose a change directly.
Additional information
No response
The text was updated successfully, but these errors were encountered: