Skip to content

400 too many request #1

@maxpou

Description

@maxpou

Find an alternative in case of HTTP 400 too many request, when attendees need to use more than 10k requests offered by Stackoverflow API.

Elements of resolution:

  • Do an HTTP call to static JSON file
  • cache requests in locale/session storage
export function get (shortUrl) {
  if (window.sessionStorage.getItem(shortUrl)) {
    return Promise.resolve(JSON.parse(window.sessionStorage.getItem(shortUrl)))
  }
  const fullUrl = `${process.env.GITHUB_URL}/${shortUrl}`

  return axios.get(fullUrl, getOAuthTokens()).then(response => {
    window.sessionStorage.setItem(shortUrl, JSON.stringify(response.data))
    return response.data
  })
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions