Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Headers to requests #7

Closed
chatterchats opened this issue Apr 4, 2024 · 0 comments
Closed

Add Headers to requests #7

chatterchats opened this issue Apr 4, 2024 · 0 comments

Comments

@chatterchats
Copy link
Contributor

chatterchats commented Apr 4, 2024

const res = await fetch("https://api.diveharder.com/all")

const res = await fetch("https://helldivers-2.fly.dev/api/801/status")

const res = await fetch("https://api-hellhub-collective.koyeb.app/api/stratagems?limit=59")

Allows endpoint devs to reach out if app starts doing something funky, and ensures that you receive the proper language from multi-language end points

let requestHeaders = { 
  "User-Agent": "Helldivers 2 Companion",
  "Accept-Language": "en-US" }

export async function API(){
  const res = await fetch("https://api.diveharder.com/all", {headers: requestHeaders})
  return res.json()
}

export async function statusAPI(){
  const res = await fetch("https://helldivers-2.fly.dev/api/801/status", {headers: requestHeaders})
  return res.json()
}

export async function stratagemsAPI(){
  const res = await fetch("https://api-hellhub-collective.koyeb.app/api/stratagems?limit=59", {headers: requestHeaders})
  return res.json()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant