Skip to content

Log warning if deprecation/sunset headers are present #332

@gr2m

Description

@gr2m

Example

curl -I https://api.github.com/teams/123
# ...
deprecation: Sat, 01 Feb 2020 00:00:00 GMT
sunset: Mon, 01 Feb 2021 00:00:00 GMT
link: <https://docs.github.com/changes/2020-01-21-moving-the-team-api-endpoints/>; rel="deprecation"; type="text/html", <https://api.github.com/organizations/0/team/0>; rel="alternate"

What we want is the following:

request("GET /teams/{team_id}")
// logs: [@octokit/request] "GET /teams/{team_id}" is deprecated. See https://docs.github.com/changes/2020-01-21-moving-the-team-api-endpoints

The warning can be logged with console.warn. We should add a custom logger option to request.defaults({ log }), similar to https://github.com/octokit/core.js#logging. But we can do that in a follow up PR. Or add it as part of this PR, your choice :)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions