Description
Code of Conduct
- I have read and agree to the GitHub Docs project's 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:
await octokit.request('PATCH /repos/{owner}/{repo}/hooks/{hook_id}/config', {
owner: 'octocat',
repo: 'hello-world',
hook_id: 42,
url: 'url'
})
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:
await octokit.request('PATCH /repos/{owner}/{repo}/hooks/{hook_id}/config', {
owner: 'octocat',
repo: 'hello-world',
data: {
hook_id: 42,
url: 'url'
}
})
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