question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Paginate does not pass through custom accept headers

See original GitHub issue

Bug Report

Current Behavior

When setting a custom Accept header, the paginate function does not use the value in any request but the first.

octokit.paginate(
  octokit.apps.getInstallationRepositories({
    per_page: 100,
    headers: {
      accept: 'application/vnd.github.machine-man-preview+json,application/vnd.github.mercy-preview+json'
    }
  }),
  (res) => res.data.repositories
)

Expected behavior/code

Every request that paginate makes uses the custom headers defined.

Environment

  • Probot version(s): 7.2.0
  • Node/npm version: Node 10.13.0
  • OS: macOS

Related Octokit / Probot links

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
gr2mcommented, Jan 10, 2019

Yes we do that via #744 but we keep the old one around and log a deprecation warning to make it easier for folks to upgrade

0reactions
gr2mcommented, Mar 18, 2019

That should work as expected with Probot 9, note that the API changed. The old API is still working, but logs a deprecation message

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using pagination in the REST API - GitHub Docs
When a response is paginated, the response headers will include a link header. The link header will be omitted if the endpoint does...
Read more >
http - Paging in a Rest Collection - Stack Overflow
To request a specific part of a collection, the client MUST use the "Range" header, and fill the "If-Match" header with the ETag...
Read more >
How to pass Pagination rules during a rest api calls in copy ...
For the authorization, that should be placed under the "additional headers" section, not the "pagination" section. You do not expect new bearer ...
Read more >
REST API paging via headers
There are several possible negatives when considering custom header fields. Browser based testing will be difficult; Proxies sometimes ...
Read more >
February 10: Pagination in a json-server API with the link header
The link header is a string — not an array or object — and you'll have to parse it to an Object do...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found